]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
run: Wait for child process in try block in spawn()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 18 Feb 2025 10:06:43 +0000 (11:06 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 18 Feb 2025 10:42:45 +0000 (11:42 +0100)
If we only wait in finally block then any keyboard interrupt
triggered during the wait will leave the child process alive and
won't wait for it to exit. Let's make sure this doesn't happen by
waiting in the try block as well.

mkosi/run.py

index 928634e36ed6477710cca610a78e6814db766a33..57b3ef468fc2f80a66b9f6d86f24533fbd829c41 100644 (file)
@@ -227,6 +227,7 @@ def spawn(
 
         try:
             yield proc
+            proc.wait()
         except KeyboardInterrupt:
             proc.send_signal(signal.SIGINT)
             raise