diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2019-08-07 17:50:49 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-08-08 10:22:36 +0100 |
commit | e1f589f04475c67ebb683a5b13004bd614be99ef (patch) | |
tree | 66a9366cb674a10d2d2f90ba3aba4b85a00abe96 /bitbake/lib/bb/ui | |
parent | 016b91b334c17cf542711a90fcde8d7278867eb0 (diff) | |
download | poky-e1f589f04475c67ebb683a5b13004bd614be99ef.tar.gz |
bitbake: knotty: Fix for the Second Keyboard Interrupt
Fixed:
$ rm -fr tmp-glibc/cache/default-glibc/qemux86/x86_64/bb_cache.dat* ; bitbake -p
Press the first Ctrl-C when the parsing process is at about 50%:
Keyboard Interrupt, closing down...
Then presss the second Ctrl-C:
File "/path/to/bitbake/bitbake/lib/bb/ui/knotty.py", line 619, in main
event = eventHandler.waitEvent(0.25)
File "/path/to/bitbake/lib/bb/server/process.py", line 591, in waitEvent
self.eventQueueNotify.wait(delay)
File "/usr/lib/python3.5/threading.py", line 549, in wait
signaled = self._cond.wait(timeout)
File "/usr/lib/python3.5/threading.py", line 297, in wait
gotit = waiter.acquire(True, timeout)
KeyboardInterrupt
Capture the second KeyboardInterrupt during stateShutdown is running can fix
the problem. There may be still tracebacks for the third KeyboardInterrupt, but
I'm leaning to not fix it since we aimed for supporting 2 KeyboardInterrupts
only.
(Bitbake rev: 8c26b451f22193ef1c544e2017cc84515566c1b8)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-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: |