Merge branch 'fix-wait-for-child-overlay' of https://github.com/jackielii/kitty

This commit is contained in:
Kovid Goyal 2025-10-27 21:58:38 +05:30
commit 1bed965115
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -132,6 +132,11 @@ def response_from_kitty(self, boss: Boss, window: Window | None, payload_get: Pa
if tabs and tabs[0]:
target_tab = tabs[0]
# Create responder before defining callback to avoid closure issue
responder = None
if payload_get('wait_for_child_to_exit') and not payload_get('no_response'):
responder = self.create_async_responder(payload_get, window)
def on_child_death(exit_status: int, exc: Exception | None) -> None:
code = os.waitstatus_to_exitcode(exit_status)
ans = str(code)
@ -141,7 +146,8 @@ def on_child_death(exit_status: int, exc: Exception | None) -> None:
ans = Signals(-code).name
except ValueError:
pass
responder.send_data(ans)
if responder is not None:
responder.send_data(ans)
w = do_launch(
boss, opts, payload_get('args') or [], target_tab=target_tab, rc_from_window=window, base_env=base_env,
@ -152,7 +158,6 @@ def on_child_death(exit_status: int, exc: Exception | None) -> None:
if not payload_get('wait_for_child_to_exit'):
return str(0 if w is None else w.id)
responder = self.create_async_responder(payload_get, window)
return AsyncResponse()
def cancel_async_request(self, boss: 'Boss', window: Window | None, payload_get: PayloadGetType) -> None: