-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Interop with nodemon --exec
and ncc run
#253
Comments
Thanks for sharing such a clear description here @adamelliotfields. We should definitely support the SIGUSR2 signal as expected (as well as any others we may have missed). As for the |
Thanks for the quick reply, @guybedford! Adding I'll play around with Per the docs:
This works (not sure if this is the direction you had in mind, or if you want to build on top of it): function exit (code) {
require("rimraf").sync(outDir);
// if the child process calls process.exit() on SIGTERM, don't exit
if (code === 0) return;
process.exit();
}
// code will either be a number (exit code) or a string (signal)
ps.on("exit", (code) => {
exit(code);
});
process.on("SIGTERM", exit);
process.on("SIGINT", exit);
process.on("SIGUSR2", exit); |
Thanks for the suggestions @adamelliotfields. I started looking into the |
Closing this for now, let's track a separate issue for |
Sounds good @guybedford. For now, Nodemon works for me. |
Nodemon sends the
SIGUSR2
signal when a watched file changes, which can be handled in your app to gracefully shutdown.Since NCC does not listen for
SIGUSR2
, it will error:In #228, listeners for
SIGINT
andSIGTERM
were added. I'd like to add a listener forSIGUSR2
as well (I've tested this locally and it resolves the issue).Note that
ncc run --watch
won't work for me becauseps.kill()
will send aSIGTERM
signal to my app, which will cause the process to exit, which stops NCC.Minimal Reproducible Example
Copy the following files, run
npm install
, and thennpm run start:ncc
. While the app is running, make a change tosrc/index.js
and observe the results.Run
npm run start:nodemon
and make a change to observe the desired result.package.json
src/index.js
The text was updated successfully, but these errors were encountered: