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.
I ran into an issue where I would Ctrl-C a running process, and dotenv-cli would forward the resulting
SIGINT
signal to the child process, but would also immediately terminate, leaving the child process in a kind of zombie state.You can see this in action using the following test file:
This should produce the following output (pressing Ctrl+C at the appropriate time):
Note that the new shell prompt appears once the script has fully exited.
Running
npx dotenv -- node test.mjs
currently will produce the following output (again, pressing Ctrl+C at the appropriate time).Note that the prompt appears once the parent
dotenv
program has finished, but the childtest.mjs
continues running after this point.This PR explicitly forwards a number of signals to the child process. This ensures that the signals are not handled in
dotenv-cli
itself, but always in the child process, which prevents the above case where the parent process terminates prematurely.I have added a bunch of signals that I think should be relevant in various cross-platform situations, but I'm not wedded to this particular set of signals here.