force_exit() to make exit work with all fdroid build conditions

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.
This commit is contained in:
Hans-Christoph Steiner 2018-11-14 14:27:32 +01:00
parent 568256f75c
commit 1f346b3149
3 changed files with 19 additions and 10 deletions

View file

@ -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)