1
mirror of https://github.com/streamlink/streamlink synced 2024-11-14 01:04:54 +01:00

refactor error code determination

This commit is contained in:
Jake Robertson 2017-09-29 08:43:39 -04:00
parent b6939dc8e1
commit 25d044bdb6

View File

@ -1010,6 +1010,8 @@ def check_version(force=False):
def main():
error_code = 0
setup_args()
setup_streamlink()
setup_plugins()
@ -1043,21 +1045,21 @@ def main():
setup_options()
setup_plugin_options()
handle_url()
except KeyboardInterrupt as keyboard_interrupt:
except KeyboardInterrupt:
# Close output
if output:
output.close()
console.msg("Interrupted! Exiting...")
interrupt = keyboard_interrupt
error_code = 130
finally:
if stream_fd:
try:
console.logger.info("Closing currently open stream...")
stream_fd.close()
if 'interrupt' in locals():
sys.exit(130)
except KeyboardInterrupt:
sys.exit(130)
error_code = 130
finally:
sys.exit(error_code)
elif args.twitch_oauth_authenticate:
authenticate_twitch_oauth()
elif args.help: