streamlink_cli.main: close stream_fd on exit (#427)

* streamlink_cli.main: close stream_fd on exit

* streamlink_cli.main: don't close output in finnaly

* streamlink_cli.main: added 'except KeyboardInterrupt' in finnaly block

* changed console message type
This commit is contained in:
John Smith 2017-01-16 22:53:23 +05:00 committed by Forrest
parent b2b6d5b28c
commit 0b334a09d7
1 changed files with 3 additions and 5 deletions

View File

@ -931,16 +931,14 @@ def main():
# Close output
if output:
output.close()
# Make sure current stream gets properly cleaned up
console.msg("Interrupted! Exiting...")
finally:
if stream_fd:
console.msg("Interrupted! Closing currently open stream...")
try:
console.logger.info("Closing currently open stream...")
stream_fd.close()
except KeyboardInterrupt:
sys.exit()
else:
console.msg("Interrupted! Exiting...")
elif args.twitch_oauth_authenticate:
authenticate_twitch_oauth()
elif args.help: