From 69baaa372094360e43ce1edd2170bb590c542016 Mon Sep 17 00:00:00 2001 From: Andrew MacMurray Date: Fri, 8 Aug 2025 20:24:05 +0100 Subject: [PATCH] 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` --- src/Gren/Kernel/ChildProcess.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Gren/Kernel/ChildProcess.js b/src/Gren/Kernel/ChildProcess.js index 8e16717..c46fc57 100644 --- a/src/Gren/Kernel/ChildProcess.js +++ b/src/Gren/Kernel/ChildProcess.js @@ -24,7 +24,7 @@ var _ChildProcess_run = function (options) { var env = options.__$environmentVariables; var shell = options.__$shell; - childProcess.execFile( + var subProc = childProcess.execFile( options.__$program, options.__$arguments, { @@ -86,6 +86,10 @@ var _ChildProcess_run = function (options) { } }, ); + + return () => { + subProc.kill(); + }; }); };