mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-04 02:00:11 +02: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)
|
sys.exit(1)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('')
|
print('')
|
||||||
sys.stdout.flush()
|
fdroidserver.common.force_exit(1)
|
||||||
sys.stderr.flush()
|
|
||||||
os._exit(1)
|
|
||||||
# These should only be unexpected crashes due to bugs in the code
|
# 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
|
# str(e) often doesn't contain a reason, so just show the backtrace
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -1148,7 +1148,7 @@ def main():
|
|||||||
appid, reason))
|
appid, reason))
|
||||||
if options.stop:
|
if options.stop:
|
||||||
logging.debug("Error encoutered, stopping by user request.")
|
logging.debug("Error encoutered, stopping by user request.")
|
||||||
sys.exit(1)
|
common.force_exit(1)
|
||||||
failed_apps[appid] = vcse
|
failed_apps[appid] = vcse
|
||||||
wikilog = str(vcse)
|
wikilog = str(vcse)
|
||||||
except FDroidException as e:
|
except FDroidException as e:
|
||||||
@ -1163,7 +1163,7 @@ def main():
|
|||||||
logging.error("Could not build app %s: %s" % (appid, e))
|
logging.error("Could not build app %s: %s" % (appid, e))
|
||||||
if options.stop:
|
if options.stop:
|
||||||
logging.debug("Error encoutered, stopping by user request.")
|
logging.debug("Error encoutered, stopping by user request.")
|
||||||
sys.exit(1)
|
common.force_exit(1)
|
||||||
failed_apps[appid] = e
|
failed_apps[appid] = e
|
||||||
wikilog = e.get_wikitext()
|
wikilog = e.get_wikitext()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -1171,7 +1171,7 @@ def main():
|
|||||||
appid, traceback.format_exc()))
|
appid, traceback.format_exc()))
|
||||||
if options.stop:
|
if options.stop:
|
||||||
logging.debug("Error encoutered, stopping by user request.")
|
logging.debug("Error encoutered, stopping by user request.")
|
||||||
sys.exit(1)
|
common.force_exit(1)
|
||||||
failed_apps[appid] = e
|
failed_apps[appid] = e
|
||||||
wikilog = str(e)
|
wikilog = str(e)
|
||||||
|
|
||||||
@ -1238,7 +1238,7 @@ def main():
|
|||||||
|
|
||||||
if not os.path.isdir(repo_dir):
|
if not os.path.isdir(repo_dir):
|
||||||
logging.critical("directory does not exists '{path}'".format(path=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))
|
logging.info("Performing Drozer scan on {0}.".format(app))
|
||||||
docker.perform_drozer_scan(apk_path, app.id, repo_dir)
|
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')
|
newpage.save('#REDIRECT [[' + wiki_page_path + ']]', summary='Update redirect')
|
||||||
|
|
||||||
# hack to ensure this exits, even is some threads are still running
|
# hack to ensure this exits, even is some threads are still running
|
||||||
sys.stdout.flush()
|
common.force_exit()
|
||||||
sys.stderr.flush()
|
|
||||||
os._exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -3424,3 +3424,16 @@ def calculate_math_string(expr):
|
|||||||
raise SyntaxError("could not parse expression '{expr}', "
|
raise SyntaxError("could not parse expression '{expr}', "
|
||||||
"only basic math operations are allowed (+, -, *)"
|
"only basic math operations are allowed (+, -, *)"
|
||||||
.format(expr=expr))
|
.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