From fc153ba08f4b81c385963c6ec60d141d15798052 Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Wed, 22 Feb 2012 19:31:45 +0100 Subject: [PATCH] adjusted exit handling to python 3 --- n900-encode.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/n900-encode.py b/n900-encode.py index ddd0544..cc3087e 100755 --- a/n900-encode.py +++ b/n900-encode.py @@ -32,6 +32,14 @@ _ffbin = None # ffmpeg binary, if set to None it is searched in your $PATH # Main Program, no changes needed below this line ########################################################################################### +# Global Variables + +mda = None +mdv = None +afifo = None +vfifo = None + +# Main Function def main(argv): """Main Function, cli argument processing and checking""" @@ -238,14 +246,16 @@ def cleanup(): # Cleanup try: - os.kill(mda.pid()) - os.kill(mdv.pid()) + if (mda != None): + os.kill(mda.pid()) + if (mdv != None): + os.kill(mdv.pid()) finally: - try: + if (afifo != None): os.remove(afifo) + if (vfifo != None): os.remove(vfifo) - finally: - sys.exit(0) + os._exit(0) def usage(): """Print avaiable commandline arguments""" @@ -262,7 +272,7 @@ def usage(): print(" --threads [-t]: Use Threads to encode") print(" --force-overwrite [-f]: Overwrite output-file if existing") print(" --help [-h]: Print this Help") - sys.exit(0) + os._exit(0) # Start the Main Function