]> code.ossystems Code Review - openembedded-core.git/commitdiff
runqemu: check the qemu PID has been set before kill()ing it
authorRoss Burton <ross@burtonini.com>
Wed, 8 Dec 2021 17:02:30 +0000 (17:02 +0000)
committerSteve Sakoman <steve@sakoman.com>
Sun, 12 Dec 2021 17:59:42 +0000 (07:59 -1000)
If runqemu is killed, check that we have a valid PID for the qemu before
sending a kill() to it.

[ YOCTO #14651 ]

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0f3afbd3a6a6bef668612f818517df7543c0a683)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
scripts/runqemu

index 10880ba6bb45da3b4c8f8cbbe1c1887afe08ab34..51607f10e598fe09354d374c191843b8cf8e0b1b 100755 (executable)
@@ -1516,7 +1516,8 @@ def main():
 
         def sigterm_handler(signum, frame):
             logger.info("SIGTERM received")
-            os.kill(config.qemupid, signal.SIGTERM)
+            if config.qemupid:
+                os.kill(config.qemupid, signal.SIGTERM)
             config.cleanup()
             # Deliberately ignore the return code of 'tput smam'.
             subprocess.call(["tput", "smam"])