Skip to content

fix(devtools): kill the hot-reload child on a second SIGINT - #110

Draft
leoafarias wants to merge 1 commit into
mainfrom
cursor/second-sigint-kills-child-204f
Draft

leoafarias wants to merge 1 commit into
mainfrom
cursor/second-sigint-kills-child-204f

Conversation

@leoafarias

Copy link
Copy Markdown
Collaborator

Bug

noir:run latches the first SIGINT, forwards it to the child, and SIGKILLs only in finally after child.exitCode. A child that handles SIGINT and stays up (an app with onExitRequested, or any other handler that does not exit) ignores the forwarded signal. A second Ctrl+C is forwarded again and the runner waits forever.

Repro

Before the fix, a packaged noir:run of a child that installs a SIGINT handler and does not exit: the first SIGINT prints SIGINT:1 and the runner stays up; the second prints SIGINT:2 and the runner never exits.

Fix

On a second SIGINT while that latch is set and the child is still running, SIGKILL the child so its exit can complete. Drop the post-exit SIGKILL.

Lines

Runner +6 / -1. With the packaged test, +68 / -3.

Validation

  • dart format --output=none --set-exit-if-changed for packages/noir (lib/, test/, example/, bin/, hook/, tool/) — passed
  • dart analyze --fatal-infos in packages/noir — passed
  • dart test test/bin/run_test.dart test/app/hot_reload_response_test.dart test/hot_reload_e2e_test.dart --concurrency=1 — passed
  • dart test test/architecture --concurrency=1 — passed
Open in Web Open in Cursor 

A child that swallows the forwarded SIGINT left noir:run blocked on
exit, because SIGKILL ran only after that exit. The second SIGINT now
kills the child while it is still running.

Co-authored-by: Leo Farias <[email protected]>

This branch has not been deployed

No deployments
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