Repository navigation
Let Ctrl+C in sight console stop a command Stata runs through shell - #448
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 4 minutes. View limit details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the command-line
sight console, Ctrl+C didn't stop a command Stata was running throughshellor!.shell sleep 60kept going until the sleep finished. #447 fixed this in the VS Code Stata pane; this is the same fix for the Bun PTY.Ctrl+C sent SIGINT to Stata's pid only, and Stata waits for whatever its
shellstarted. A terminal's ^C goes to the whole foreground process group. The helper's group-signal fix can't be reused here:detached: truewould give Stata its own session, but it also makes the PTY Stata's controlling terminal. That brings job control with it: aftershell, Stata can be stopped with SIGTTIN (see the sight-pty.c header).So Ctrl+C now takes one
ps -A -o pid=,ppid=snapshot, then sends SIGINT to Stata and to every process descended from it. Stata is signalled first, so its interrupt is already pending when the command it's waiting for ends. Hang-up, kill and resize are unchanged.Known gaps:
psis looked up on the inheritedPATH.Proof:
shell sleep 60and!sleep 60were still stuck after 8 s.sleepis left behind.sleep 20000, a Mata loop andwhile 1 {}still print--Break--.tests/integration/console/bun-pty.test.ts, fails without the fix and passed 100 runs in a row with it.bun test ./testspass (10521 tests, 0 failures).Reviewed with sol-loop: 2 rounds with gpt-6.2-sol. Sol verdict: approved
Created with Claude Opus 5.5 in Claude Code (T3 Code).