Open marvinhagemeister opened 1 year ago
It's to be noted that with #20501 the accuracy of the op sanitizer has improved to the point where forgetting await childProcess.status
will fail the test with a sanitizer error, if the sanitizers are enabled (as they are by default).
We should still ponder this, but it's less urgent now.
Now that delcaration with using
is supported and ChildProcess
implements AsyncDisposable, we can easily ensure child processes are destructed once they get out of scope:
await using proc = new Deno.Command(...).spawn();
After a debugging session regarding leaking resources in tests it turned out that a test case in the Fresh repository wasn't properly waiting for child processes to be killed.
The current way to do it should look like this:
This lead us to wonder if we could provide an easier API for that. Especially, in a test suite it's not relevant how the child process is killed. You just want this thing to be destroyed. Some random ideas: