Skip to content

Commit 3c757d1

Browse files
Allow child process spawned via Task.spawn to be cleaned up
While the full `ChildProcess.spawn` gives a lot more control over the lifecycle of a child process, this allows the simple version spawned via a task to be shut down with `Process.kill`
1 parent 6492e06 commit 3c757d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Gren/Kernel/ChildProcess.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var _ChildProcess_run = function (options) {
2424
var env = options.__$environmentVariables;
2525
var shell = options.__$shell;
2626

27-
childProcess.execFile(
27+
var subProc = childProcess.execFile(
2828
options.__$program,
2929
options.__$arguments,
3030
{
@@ -86,6 +86,10 @@ var _ChildProcess_run = function (options) {
8686
}
8787
},
8888
);
89+
90+
return () => {
91+
subProc.kill();
92+
}
8993
});
9094
};
9195

0 commit comments

Comments
 (0)