diff options
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 1c72aa2947..35736ade03 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -689,17 +689,27 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
689 | if params.observe_only: | 689 | if params.observe_only: |
690 | print("\nKeyboard Interrupt, exiting observer...") | 690 | print("\nKeyboard Interrupt, exiting observer...") |
691 | main.shutdown = 2 | 691 | main.shutdown = 2 |
692 | if not params.observe_only and main.shutdown == 1: | 692 | |
693 | def state_force_shutdown(): | ||
693 | print("\nSecond Keyboard Interrupt, stopping...\n") | 694 | print("\nSecond Keyboard Interrupt, stopping...\n") |
694 | _, error = server.runCommand(["stateForceShutdown"]) | 695 | _, error = server.runCommand(["stateForceShutdown"]) |
695 | if error: | 696 | if error: |
696 | logger.error("Unable to cleanly stop: %s" % error) | 697 | logger.error("Unable to cleanly stop: %s" % error) |
698 | |||
699 | if not params.observe_only and main.shutdown == 1: | ||
700 | state_force_shutdown() | ||
701 | |||
697 | if not params.observe_only and main.shutdown == 0: | 702 | if not params.observe_only and main.shutdown == 0: |
698 | print("\nKeyboard Interrupt, closing down...\n") | 703 | print("\nKeyboard Interrupt, closing down...\n") |
699 | interrupted = True | 704 | interrupted = True |
700 | _, error = server.runCommand(["stateShutdown"]) | 705 | # Capture the second KeyboardInterrupt during stateShutdown is running |
701 | if error: | 706 | try: |
702 | logger.error("Unable to cleanly shutdown: %s" % error) | 707 | _, error = server.runCommand(["stateShutdown"]) |
708 | if error: | ||
709 | logger.error("Unable to cleanly shutdown: %s" % error) | ||
710 | except KeyboardInterrupt: | ||
711 | state_force_shutdown() | ||
712 | |||
703 | main.shutdown = main.shutdown + 1 | 713 | main.shutdown = main.shutdown + 1 |
704 | pass | 714 | pass |
705 | except Exception as e: | 715 | except Exception as e: |