Restore python signal handlers properly after the test

This commit is contained in:
Kovid Goyal 2022-07-10 15:50:22 +05:30
parent 61b733bae9
commit 751a52153d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -14,7 +14,7 @@ from contextlib import suppress
from kitty.constants import kitty_exe, terminfo_dir from kitty.constants import kitty_exe, terminfo_dir
from kitty.fast_data_types import ( from kitty.fast_data_types import (
CLD_EXITED, CLD_KILLED, CLD_STOPPED, get_options, has_sigqueue, install_signal_handlers, CLD_EXITED, CLD_KILLED, CLD_STOPPED, get_options, has_sigqueue, install_signal_handlers,
read_signals, remove_signal_handlers, sigqueue read_signals, sigqueue
) )
from . import BaseTest from . import BaseTest
@ -159,6 +159,7 @@ import os, json; from kitty.utils import *; from kitty.fast_data_types import ge
self.ae(int(p.from_worker.readline()), data['pid']) self.ae(int(p.from_worker.readline()), data['pid'])
def test_signal_handling(self): def test_signal_handling(self):
from kitty.prewarm import restore_python_signal_handlers
expecting_code = 0 expecting_code = 0
expecting_signal = signal.SIGCHLD expecting_signal = signal.SIGCHLD
expecting_value = 0 expecting_value = 0
@ -226,4 +227,4 @@ import os, json; from kitty.utils import *; from kitty.fast_data_types import ge
p.stdin.close() p.stdin.close()
p.wait(1) p.wait(1)
finally: finally:
remove_signal_handlers() restore_python_signal_handlers()