-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Deno.Process close()/status()/kill() #6373
Comments
I was also wondering what I just tried |
Close releases Deno’s memory associated with the process. So the subprocess will continue to run. Kill actually sends a signal to the subprocess. |
@ry one thing with close is that it doesn't address closing any of the file descriptors - for example, on some utility code I have I had to: async stop(): Promise<void> {
if (!this.stopped) {
this.stopped = true;
this.process.stderr?.close();
this.process.kill(Deno.Signal.SIGKILL);
this.process.close();
}
await this.done;
} The unexpected thing is that |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Thanks for the explanation. Is using |
Deno.Process probably needs a bit more documentation:
close()
is called,status()
will throw an exception with a bad resource id.kill()
followed by astatus()
works finestatus()
to always work regardless of how the process was terminated.I would have expected status() to resolve its promise regardless of how the Process is closed/kill or otherwise.
My use of Deno.run() is running a server that I can use for tests. So this creates interesting because if things don't close properly, the tests will fail with resource leaks (love that).
The text was updated successfully, but these errors were encountered: