main: Ensure that exit_status_code always is assigned
KeyboardInterrupts are not always catched in commands.py. As far as I have seen, if I/O operations are ongoing, a KeyboardInterrupt may be raised there instead of in commands.py. In some cases, this may cause loop.run() to return, which previously resulted in exit_status_code being referenced before assignment.
This commit is contained in:
parent
d2eb7fdd10
commit
f0b66bdfcb
@ -265,6 +265,7 @@ class RootCommand(Command):
|
||||
backend_classes = args.registry['backend']
|
||||
frontend_classes = args.registry['frontend']
|
||||
|
||||
exit_status_code = 0
|
||||
try:
|
||||
mixer = self.start_mixer(config, mixer_class)
|
||||
audio = self.start_audio(config, mixer)
|
||||
@ -279,7 +280,6 @@ class RootCommand(Command):
|
||||
exit_status_code = 1
|
||||
except KeyboardInterrupt:
|
||||
logger.info('Interrupted. Exiting...')
|
||||
exit_status_code = 0
|
||||
finally:
|
||||
loop.quit()
|
||||
self.stop_frontends(frontend_classes)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user