Skip to content
TypeScript

fix(server): force-stop timed out login shell probes (#7295)

hbw00111123e5ba06513
diff --git a/packages/shared/src/shell.test.ts b/packages/shared/src/shell.test.ts
index a4a17cda2cd..6ae7401a488 100644
--- a/packages/shared/src/shell.test.ts
+++ b/packages/shared/src/shell.test.ts
@@ -135,6 +135,13 @@ describe("readEnvironmentFromLoginShell", () => {
SSH_AUTH_SOCK: "/tmp/secretive.sock",
});
expect(execFile).toHaveBeenCalledTimes(1);
+ expect(execFile).toHaveBeenCalledWith("/bin/zsh", expect.any(Array), {
+ encoding: "utf8",
+ timeout: 5000,
+ killSignal: "SIGKILL",
+ detached: true,
+ stdio: ["ignore", "pipe", "ignore"],
+ });
});
it("omits environment variables that are missing or empty", () => {
diff --git a/packages/shared/src/shell.ts b/packages/shared/src/shell.ts
index c5e6a7346fb..f3aaa4a11c4 100644
--- a/packages/shared/src/shell.ts
+++ b/packages/shared/src/shell.ts
@@ -24,6 +24,7 @@ type ExecFileSyncLike = (
options: {
encoding: "utf8";
timeout: number;
+ killSignal?: NodeJS.Signals | number;
detached?: true;
stdio?: ["ignore", "pipe", "ignore"];
},
@@ -302,6 +303,7 @@ export const readEnvironmentFromLoginShell: ShellEnvironmentReader = (
const output = execFile(shell, ["-ilc", buildEnvironmentCaptureCommand(shell, names)], {
encoding: "utf8",
timeout: 5000,
+ killSignal: "SIGKILL",
detached: true,
stdio: ["ignore", "pipe", "ignore"],
});