Better handle signals in tsc CLI - #4911
Conversation
|
Wasn't part of the original intent for handling signals to do something special during profiling? |
There was a problem hiding this comment.
Pull request overview
Restores default OS signal handling for the tsc CLI so SIGINT and SIGTERM terminate immediately.
Changes:
- Removes CLI signal interception.
- Uses a background context for compilation; API and LSP handling remain unchanged.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Yeah.... but the only way that would work is if we profile watch mode. Otherwise we'd just let it go to exit. I don't think it's worth it for now if it hangs Ctrl+C; we can invent a mode which does cancellation if profiling isn't running or add our own exit hooks (like Go does!). But that's more complicated. |
|
per my testing (see comment: #4592 (comment)) this will cause odd panics if you here is my attempt at this same idea that avoids the 'all goroutines are blocked' issue main...lukesandberg:typescript-go:lukesandberg/no_signal_handler_for_compile |
|
That's plausible, but that platform code would belong in |
|
Feel free to open it, I just assumed you wouldn't reply so quickly 😄 |
|
I don't have permissions to open PRs anymore |
|
If you restore the branch in #4592, I can reopen it |
|
dd5868e is on a different branch |
902f44f to
934a059
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (1)
internal/execute/tsc.go:126
- This new signal/watch path has no regression coverage. Because this change fixes a process-level interruption bug, add subprocess tests that send SIGINT/SIGTERM and verify normal compilation, watch mode, and profiling terminate promptly without the watch deadlock and that profiling flushes its output before exit.
if buildCommand.CompilerOptions.Watch.IsTrue() && !profiled && options.WatchContext != nil {
var stop context.CancelFunc
ctx, stop = options.WatchContext(ctx)
defer stop()
934a059 to
a5e72ba
Compare
|
I'm going to just defer this until after the repo move. |
|
Thank you for contributing to the TypeScript native port! Development has moved from this repository back to the main microsoft/TypeScript repository. GitHub does not have PR transfer functionality, so we're closing this PR here. If this change is still relevant, please reopen it as a new pull request in See microsoft/typescript-go#4918 for more information about the move. |
See also #4592
Fixes microsoft/TypeScript#63856