[oe-commits] [bitbake] 02/02: knotty: Fix for the Second Keyboard Interrupt

git at git.openembedded.org git at git.openembedded.org
Wed Aug 7 18:44:20 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 8c26b451f22193ef1c544e2017cc84515566c1b8
Author: Robert Yang <liezhi.yang at windriver.com>
AuthorDate: Wed Aug 7 17:50:49 2019 +0800

    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.
    
    Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/ui/knotty.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 1c72aa2..35736ad 100644
--- a/lib/bb/ui/knotty.py
+++ b/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:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list