Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(env-path): kill the login-shell probe before closing its stdout

milind-sonia5b84e92c71a
diff --git a/server/env-path.ts b/server/env-path.ts
index bee9264c0e..c942779637 100644
--- a/server/env-path.ts
+++ b/server/env-path.ts
@@ -153,13 +153,14 @@ function probeLoginShellPath(): void {
if (finished) return;
finished = true;
clearTimeout(deadline);
- child.stdout?.destroy();
// An interactive shell ignores SIGTERM, and something its rc started in the background can hold stdout open after it exits.
+ // Killed before stdout closes: a closed pipe ends only the writer, and the shell would run its next command meanwhile.
if (exitCode === undefined && child.pid) {
try {
process.kill(-child.pid, "SIGKILL");
} catch {}
}
+ child.stdout?.destroy();
};
const deadline = setTimeout(finish, PROBE_TIMEOUT_MS);
deadline.unref();