mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 22:40:12 +01:00
Merge branch 'force_exit' into 'master'
force_exit() to make exit work with all `fdroid build` conditions See merge request fdroid/fdroidserver!592
This commit is contained in:
commit
f96db03121
4
fdroid
4
fdroid
@ -149,9 +149,7 @@ def main():
|
||||
sys.exit(1)
|
||||
except KeyboardInterrupt:
|
||||
print('')
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
os._exit(1)
|
||||
fdroidserver.common.force_exit(1)
|
||||
# These should only be unexpected crashes due to bugs in the code
|
||||
# str(e) often doesn't contain a reason, so just show the backtrace
|
||||
except Exception as e:
|
||||
|
@ -1148,7 +1148,7 @@ def main():
|
||||
appid, reason))
|
||||
if options.stop:
|
||||
logging.debug("Error encoutered, stopping by user request.")
|
||||
sys.exit(1)
|
||||
common.force_exit(1)
|
||||
failed_apps[appid] = vcse
|
||||
wikilog = str(vcse)
|
||||
except FDroidException as e:
|
||||
@ -1163,7 +1163,7 @@ def main():
|
||||
logging.error("Could not build app %s: %s" % (appid, e))
|
||||
if options.stop:
|
||||
logging.debug("Error encoutered, stopping by user request.")
|
||||
sys.exit(1)
|
||||
common.force_exit(1)
|
||||
failed_apps[appid] = e
|
||||
wikilog = e.get_wikitext()
|
||||
except Exception as e:
|
||||
@ -1171,7 +1171,7 @@ def main():
|
||||
appid, traceback.format_exc()))
|
||||
if options.stop:
|
||||
logging.debug("Error encoutered, stopping by user request.")
|
||||
sys.exit(1)
|
||||
common.force_exit(1)
|
||||
failed_apps[appid] = e
|
||||
wikilog = str(e)
|
||||
|
||||
@ -1238,7 +1238,7 @@ def main():
|
||||
|
||||
if not os.path.isdir(repo_dir):
|
||||
logging.critical("directory does not exists '{path}'".format(path=repo_dir))
|
||||
sys.exit(1)
|
||||
common.force_exit(1)
|
||||
|
||||
logging.info("Performing Drozer scan on {0}.".format(app))
|
||||
docker.perform_drozer_scan(apk_path, app.id, repo_dir)
|
||||
@ -1289,9 +1289,7 @@ def main():
|
||||
newpage.save('#REDIRECT [[' + wiki_page_path + ']]', summary='Update redirect')
|
||||
|
||||
# hack to ensure this exits, even is some threads are still running
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
os._exit(0)
|
||||
common.force_exit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -3424,3 +3424,16 @@ def calculate_math_string(expr):
|
||||
raise SyntaxError("could not parse expression '{expr}', "
|
||||
"only basic math operations are allowed (+, -, *)"
|
||||
.format(expr=expr))
|
||||
|
||||
|
||||
def force_exit(exitvalue=0):
|
||||
"""force exit when thread operations could block the exit
|
||||
|
||||
The build command has to use some threading stuff to handle the
|
||||
timeout and locks. This seems to prevent the command from
|
||||
exiting, unless this hack is used.
|
||||
|
||||
"""
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
os._exit(exitvalue)
|
||||
|
Loading…
Reference in New Issue
Block a user