From 055aae23823ddca5c4f7081f2c2ca4f9e7a09570 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Jul 2022 22:10:22 +0530 Subject: [PATCH] Use correct exit codes for signals --- kitty/prewarm.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kitty/prewarm.py b/kitty/prewarm.py index 36bd99bc6..db98f3468 100644 --- a/kitty/prewarm.py +++ b/kitty/prewarm.py @@ -479,6 +479,11 @@ class SocketChild: def handle_death(self, status: int) -> None: if hasattr(os, 'waitstatus_to_exitcode'): status = os.waitstatus_to_exitcode(status) + # negative numbers are signals usually and shells report these as + # 128 + signal number, so do the same. There is no API to exit a + # process with full 32bit status information. + if -128 < status < 0: + status = 128 - status try: self.conn.sendall(f'{status}'.encode('ascii')) except OSError as e: