build: hard exit on success to avoid hanging

Something is preventing `fdroid build --all` from exiting after a long
run.  @bubu, @uniqx and I think it is because of the use of
AsynchronousFileReader, somehow it's thread does not exit. So the
workaround for now is to just try a hard exit instead of waiting for
things to finish cleanly with `sys.exit(0)`.

https://jenkins.debian.net/job/reproducible_fdroid_build_apps/94/console
This commit is contained in:
Hans-Christoph Steiner 2017-12-02 13:24:13 +01:00
parent 68bbfa7e0e
commit b8ed892ad9
2 changed files with 5 additions and 1 deletions

View File

@ -1345,7 +1345,10 @@ def main():
logging.info(ngettext("{} build failed",
"{} builds failed", len(failed_apps)).format(len(failed_apps)))
sys.exit(0)
# hack to ensure this exits, even is some threads are still running
sys.stdout.flush()
sys.stderr.flush()
os._exit(0)
if __name__ == "__main__":

View File

@ -1970,6 +1970,7 @@ def FDroidPopenBytes(commands, cwd=None, envs=None, output=True, stderr_to_stdou
raise BuildException("OSError while trying to execute " +
' '.join(commands) + ': ' + str(e))
# TODO are these AsynchronousFileReader threads always exiting?
if not stderr_to_stdout and options.verbose:
stderr_queue = Queue()
stderr_reader = AsynchronousFileReader(p.stderr, stderr_queue)