From 884efa83d6d420e5e7ce06fe8c871e3f841e442b Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Wed, 8 Dec 2021 17:02:30 +0000 Subject: runqemu: check the qemu PID has been set before kill()ing it If runqemu is killed, check that we have a valid PID for the qemu before sending a kill() to it. [ YOCTO #14651 ] (From OE-Core rev: 7e37e453e15114dec0b89636e92f93c7fa127ae4) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie (cherry picked from commit 0f3afbd3a6a6bef668612f818517df7543c0a683) Signed-off-by: Anuj Mittal Signed-off-by: Richard Purdie --- scripts/runqemu | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/runqemu b/scripts/runqemu index f3527a4412..f9a1a0da32 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -1573,7 +1573,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"]) -- cgit v1.2.3-54-g00ecf