tsx
tsx copied to clipboard
SIGINT results in a forced exit every time when running `tsx watch` with npm
Acknowledgements
- [X] I read the documentation and searched existing issues to avoid duplicates
- [X] I am reporting a confirmed bug (not seek debugging help)
- [X] I understand this is a collaborative project and relies on my contributions
- [X] I read and understood the Contribution guide
Minimal reproduction URL
https://github.com/jabrks/tsx-reproduction
Problem & expected behavior (under 200 words)
Using npm to run tsx watch results in the following error each time the process is interrupted
[tsx] Previous process hasn't exited yet. Force killing...
The GitHub action in the reproduction linked above demonstrates this by artificially exiting the process after 3 seconds. npm's signal handling behaviour was changed in v10.3.0 as a result of https://github.com/npm/run-script/pull/188 which seems to be related
Bugs are expected to be fixed by those affected by it
- [ ] I'm interested in working on this issue
Compensating engineering work financially will speed up resolution
- [ ] I'm willing to offer financial support
having same issue :(
Same here :(
I'm also seeing this with
pnpm tsx watch [...args]
I see that when I use the command "tsx watch index.ts", this snippet:
process.on("SIGINT", () => { console.log("Received SIGINT signal"); process.exit(0); });
does not log the sentence "Received SIGINT signal" when I press ctrl+c
Also having this issue when SIGINT is received my process starts graceful shutdown. but tsx does not let it exit properly and kills it.
actually issue is not with tsx but pnpm if I run ./node_modules/.bin/tsx watch ./my-script exit works well.
I experience the issue with pnpx tsx watch ...
see issue on pnpm https://github.com/pnpm/pnpm/issues/7374 (which is still open)
turbowatch has some motivations written, possibly related, and others https://github.com/gajus/turbowatch?#motivation as well as some watchers choices and drawbacks, in attempt to fix certain issues. If they are not yet, I suppose tsx should be aware of them.