diff options
Diffstat (limited to 'poky/bitbake/lib/bb/ui')
-rw-r--r-- | poky/bitbake/lib/bb/ui/knotty.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/poky/bitbake/lib/bb/ui/knotty.py b/poky/bitbake/lib/bb/ui/knotty.py index 1c72aa294..35736ade0 100644 --- a/poky/bitbake/lib/bb/ui/knotty.py +++ b/poky/bitbake/lib/bb/ui/knotty.py @@ -689,17 +689,27 @@ def main(server, eventHandler, params, tf = TerminalFilter): if params.observe_only: print("\nKeyboard Interrupt, exiting observer...") main.shutdown = 2 - if not params.observe_only and main.shutdown == 1: + + def state_force_shutdown(): print("\nSecond Keyboard Interrupt, stopping...\n") _, error = server.runCommand(["stateForceShutdown"]) if error: logger.error("Unable to cleanly stop: %s" % error) + + if not params.observe_only and main.shutdown == 1: + state_force_shutdown() + if not params.observe_only and main.shutdown == 0: print("\nKeyboard Interrupt, closing down...\n") interrupted = True - _, error = server.runCommand(["stateShutdown"]) - if error: - logger.error("Unable to cleanly shutdown: %s" % error) + # Capture the second KeyboardInterrupt during stateShutdown is running + try: + _, error = server.runCommand(["stateShutdown"]) + if error: + logger.error("Unable to cleanly shutdown: %s" % error) + except KeyboardInterrupt: + state_force_shutdown() + main.shutdown = main.shutdown + 1 pass except Exception as e: |