From ffa9459eedb67e9d44f377c4e012d8e27a948b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Sat, 16 Nov 2019 17:12:56 +0000 Subject: [PATCH] commandrunner: Forward KeyboardInterrupt to command Some commands, notably gdb, use ctrl+c themselves to perform actions without exiting. Instead of making meson exit and thus, kill the subprocess, ignore the KeyboardInterrupt and continue waiting for the child. --- mesonbuild/scripts/commandrunner.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mesonbuild/scripts/commandrunner.py b/mesonbuild/scripts/commandrunner.py index 38071141add7..22da4178d6e6 100644 --- a/mesonbuild/scripts/commandrunner.py +++ b/mesonbuild/scripts/commandrunner.py @@ -71,7 +71,12 @@ def run(args): command = args[4] arguments = args[5:] pc = run_command(src_dir, build_dir, subdir, meson_command, command, arguments) - pc.wait() + while True: + try: + pc.wait() + break + except KeyboardInterrupt: + pass return pc.returncode if __name__ == '__main__':