summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/runqemu14
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 409d17c648..087220ca0a 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1202,6 +1202,7 @@ class BaseConfig(object):
1202 self.qemu_opt += " -serial mon:vc -serial null" 1202 self.qemu_opt += " -serial mon:vc -serial null"
1203 1203
1204 def start_qemu(self): 1204 def start_qemu(self):
1205 import shlex
1205 if self.kernel: 1206 if self.kernel:
1206 kernel_opts = "-kernel %s -append '%s %s %s %s'" % (self.kernel, self.kernel_cmdline, 1207 kernel_opts = "-kernel %s -append '%s %s %s %s'" % (self.kernel, self.kernel_cmdline,
1207 self.kernel_cmdline_script, self.get('QB_KERNEL_CMDLINE_APPEND'), 1208 self.kernel_cmdline_script, self.get('QB_KERNEL_CMDLINE_APPEND'),
@@ -1211,11 +1212,16 @@ class BaseConfig(object):
1211 else: 1212 else:
1212 kernel_opts = "" 1213 kernel_opts = ""
1213 cmd = "%s %s" % (self.qemu_opt, kernel_opts) 1214 cmd = "%s %s" % (self.qemu_opt, kernel_opts)
1215 cmds = shlex.split(cmd)
1214 logger.info('Running %s\n' % cmd) 1216 logger.info('Running %s\n' % cmd)
1215 process = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) 1217 process = subprocess.Popen(cmds, stderr=subprocess.PIPE)
1216 self.qemupid = process.pid 1218 self.qemupid = process.pid
1217 if process.wait(): 1219 retcode = process.wait()
1218 logger.error("Failed to run qemu: %s", process.stderr.read().decode()) 1220 if retcode:
1221 if retcode == -signal.SIGTERM:
1222 logger.info("Qemu terminated by SIGTERM")
1223 else:
1224 logger.error("Failed to run qemu: %s", process.stderr.read().decode())
1219 1225
1220 def cleanup(self): 1226 def cleanup(self):
1221 if self.cleaned: 1227 if self.cleaned:
@@ -1310,6 +1316,7 @@ def main():
1310 logger.info("SIGTERM received") 1316 logger.info("SIGTERM received")
1311 os.kill(config.qemupid, signal.SIGTERM) 1317 os.kill(config.qemupid, signal.SIGTERM)
1312 config.cleanup() 1318 config.cleanup()
1319 subprocess.run(["tput", "smam"])
1313 signal.signal(signal.SIGTERM, sigterm_handler) 1320 signal.signal(signal.SIGTERM, sigterm_handler)
1314 1321
1315 config.check_args() 1322 config.check_args()
@@ -1331,6 +1338,7 @@ def main():
1331 return 1 1338 return 1
1332 finally: 1339 finally:
1333 config.cleanup() 1340 config.cleanup()
1341 subprocess.run(["tput", "smam"])
1334 1342
1335if __name__ == "__main__": 1343if __name__ == "__main__":
1336 sys.exit(main()) 1344 sys.exit(main())