adjusted exit handling to python 3

This commit is contained in:
seiichiro 2012-02-22 19:31:45 +01:00
parent 121f6def82
commit fc153ba08f

View file

@ -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 # Main Program, no changes needed below this line
########################################################################################### ###########################################################################################
# Global Variables
mda = None
mdv = None
afifo = None
vfifo = None
# Main Function
def main(argv): def main(argv):
"""Main Function, cli argument processing and checking""" """Main Function, cli argument processing and checking"""
@ -238,14 +246,16 @@ def cleanup():
# Cleanup # Cleanup
try: try:
if (mda != None):
os.kill(mda.pid()) os.kill(mda.pid())
if (mdv != None):
os.kill(mdv.pid()) os.kill(mdv.pid())
finally: finally:
try: if (afifo != None):
os.remove(afifo) os.remove(afifo)
if (vfifo != None):
os.remove(vfifo) os.remove(vfifo)
finally: os._exit(0)
sys.exit(0)
def usage(): def usage():
"""Print avaiable commandline arguments""" """Print avaiable commandline arguments"""
@ -262,7 +272,7 @@ def usage():
print(" --threads <num> [-t]: Use <num> Threads to encode") print(" --threads <num> [-t]: Use <num> Threads to encode")
print(" --force-overwrite [-f]: Overwrite output-file if existing") print(" --force-overwrite [-f]: Overwrite output-file if existing")
print(" --help [-h]: Print this Help") print(" --help [-h]: Print this Help")
sys.exit(0) os._exit(0)
# Start the Main Function # Start the Main Function