-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Programmatically exiting deno does not kill child processes running #8772
Comments
That looks to be a bit related to #3603 in the sense that they both have something to do with cleaning up on
From doc(https://doc.rust-lang.org/std/process/fn.exit.html):
So ideally |
I'm not sure what is the expected behavior here, but I found node.js works in a similar way. If you run the following and press ctrl-c, the subprocess doesn't leak, // node.js
require("child_process").exec("sleep 1000"); but the follwoing leaks require("child_process").exec("sleep 1000");
process.exit(0); |
It seems that when pressing ctrl-c the tty driver program sends sigint to the process group. That's what OS does and not the responsibility of single process (deno cli in this case). So I think we shouldn't do anything special for this situation. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
As mentioned by @kt3k, this behaviour aligns to Node.js and further research indicating that this isn't something that Deno should do specifically. |
I have discovered that calling
Deno.exit()
will stop the deno process, but will not stop any subprocesses running inside it. This is different than the behavior when ctrl-c'ing a program.small repro:
output from the program:
vs when I cancel early with ctrl+c, the subprocess also receives a stop signal:
Is this expected behavior?
The text was updated successfully, but these errors were encountered: