diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2021-10-18 19:15:00 +0200 |
|---|---|---|
| committer | Xavier Claessens <xclaesse@gmail.com> | 2021-10-18 15:16:10 -0400 |
| commit | 8945c53711c92f2fb48cfab94870e3cf759f3a35 (patch) | |
| tree | ac1814c3dc6b84121029ae17a260d79f66ffd626 | |
| parent | 67185565717fc768fb35bbf8605d040d816862fc (diff) | |
| download | meson-8945c53711c92f2fb48cfab94870e3cf759f3a35.tar.gz | |
mtest: limit "magic" CTRL+C behavior to process group leaders
If meson is not a process group leader, a SIGINT will be delivered also to
its parent process (and possibly other processes). The parent process then
will probably exit and mtest will continue running in the background, without
any way to interrupt the run completely.
To fix this, treat SIGINT and SIGTERM the same way unless mtest is a
process group leader.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| -rw-r--r-- | mesonbuild/mtest.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 36c4da982..74d7d8bf1 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -1893,7 +1893,10 @@ class TestHarness: l.start(self) if sys.platform != 'win32': - asyncio.get_event_loop().add_signal_handler(signal.SIGINT, sigint_handler) + if os.getpgid(0) == os.getpid(): + asyncio.get_event_loop().add_signal_handler(signal.SIGINT, sigint_handler) + else: + asyncio.get_event_loop().add_signal_handler(signal.SIGINT, sigterm_handler) asyncio.get_event_loop().add_signal_handler(signal.SIGTERM, sigterm_handler) try: for runner in runners: |
