Skip to content

fix(signals): note_console_ctrl_c + persist exit_code on untrapped fatal signal; kill interrupted externals - #1447

Merged
caomengxuan666 merged 1 commit into
unixwin:masterfrom
Catapult291:fix/console-ctrl-c-self-signal
Oct 23, 2026
Merged

caomengxuan666 merged 1 commit into
unixwin:masterfrom
Catapult291:fix/console-ctrl-c-self-signal

Conversation

@Catapult291

Copy link
Copy Markdown
Contributor

Summary

Engine had no hook for the Windows host console Ctrl-C flag; untrapped fatal signals did not write executor.exit_code before unwinding; interrupted external waits could leave children.

Changes

  • kill::note_console_ctrl_c() → queue_self_signal(2) on Windows (no-op elsewhere).
  • trap_exec: write self.exit_code before Err(ExitCode(128+sig)).
  • external_inner: on signal-interrupted wait, child.kill() + wait() then unwind.

Host companion: unixwin/niubash#542 (fix/console-ctrl-c-inject-self-signal). Related open: #1250, #1034.

Niubash defect log D8 (2026-10-23).

kill::note_console_ctrl_c() queues signal 2 on Windows; trap_exec
writes executor.exit_code before unwinding with 128+sig; external wait
kill+wait on signal interrupt so children do not linger.
@caomengxuan666
caomengxuan666 merged commit fa57925 into unixwin:master Oct 23, 2026
2 checks passed
@caomengxuan666

Copy link
Copy Markdown
Member

Reviewed — clean. The child reap on aborted wait-slice is a real fix on top of the API addition, and the Unix no-double-dispatch note saves the next person a subtle bug. Merged; the niubash host half (#542) follows once the pin carries this.

@caomengxuan666

Copy link
Copy Markdown
Member

Follow-up: your PR's own CI couldn't run (first-contribution workflow gate on our side — that's ours, not yours), so validation happened on master after the merge: the full battery just passed on the merge result. The child reap on aborted wait-slice and the exit_code-before-unwind fixes are both confirmed good. The niubash host half (#542) follows once our vendored pin carries this — we'll ping on that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants