Open razwanizmi opened 3 years ago
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.
Hey, the original fix from #7203 did work, however process.stdin.resume()
has been reverted in #8700, and consequently broke it again.
The simplest way to reproduce the issue is to create a new CRA app and run:
node_modules/react-scripts/bin/react-scripts.js start <&-
Note: <&-
immediately closes stdin of the script.
A similar story happened in rollup. It watched stdin, then process.stdin.resume()
was removed in https://github.com/rollup/rollup/pull/2410, but then added back in https://github.com/rollup/rollup/pull/3493.
See the commit description in https://github.com/rollup/rollup/commit/57bb54ea26bef7eab062925364158a4c478062f3 for more details.
I think we should bring process.stdin.resume()
back.
Describe the bug
I use Create React App as part of an asset pipeline in a web framework (in my case Phoenix). As part of the development pipeline, I've set up a watcher to run
react-scripts start
whenever my web server starts.This works fine, but whenever I terminate my web server, Webpack dev server remains running in the background. I want Webpack dev server to listen on stdin for SIGINT and SIGTERM so it can terminate itself.
I noticed in start.js that there is an event listener set up for SIGINT and SIGTERM, but this didn't work for me.
Referring to this documentation, I can fix the issue on my machine by adding this line;
before any of the process event handlers are added. I think process will exit prematurely and not listen to stdin without that.
If this works for everyone, I'd be happy to put in a PR.
Did you try recovering your dependencies?
Yes.
Which terms did you search for in User Guide?
Start, listen, stdin, sigint, and sigterm.
Environment
Steps to reproduce
Described above.
Expected behavior
react-scripts start
should listen to stdin for SIGINT and SIGTERM and terminate itself.Actual behavior
Webpack dev server keeps running in the background after its spawning process gets terminated.