diff options
-rw-r--r-- | bitbake/lib/bb/ui/toasterui.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py index c2d41f791f..5382935f82 100644 --- a/bitbake/lib/bb/ui/toasterui.py +++ b/bitbake/lib/bb/ui/toasterui.py | |||
@@ -441,7 +441,22 @@ def main(server, eventHandler, params): | |||
441 | if ioerror.args[0] == 4: | 441 | if ioerror.args[0] == 4: |
442 | pass | 442 | pass |
443 | except KeyboardInterrupt: | 443 | except KeyboardInterrupt: |
444 | main.shutdown = 1 | 444 | if params.observe_only: |
445 | print("\nKeyboard Interrupt, exiting observer...") | ||
446 | main.shutdown = 2 | ||
447 | if not params.observe_only and main.shutdown == 1: | ||
448 | print("\nSecond Keyboard Interrupt, stopping...\n") | ||
449 | _, error = server.runCommand(["stateForceShutdown"]) | ||
450 | if error: | ||
451 | logger.error("Unable to cleanly stop: %s" % error) | ||
452 | if not params.observe_only and main.shutdown == 0: | ||
453 | print("\nKeyboard Interrupt, closing down...\n") | ||
454 | interrupted = True | ||
455 | _, error = server.runCommand(["stateShutdown"]) | ||
456 | if error: | ||
457 | logger.error("Unable to cleanly shutdown: %s" % error) | ||
458 | buildinfohelper.cancel_cli_build() | ||
459 | main.shutdown = main.shutdown + 1 | ||
445 | except Exception as e: | 460 | except Exception as e: |
446 | # print errors to log | 461 | # print errors to log |
447 | import traceback | 462 | import traceback |