isolate eval runtimes from terminal

This commit is contained in:
Colin Mason
2026-07-12 20:29:38 -04:00
parent edd959a381
commit c40ccdc684
13 changed files with 211 additions and 19 deletions
@@ -67,6 +67,18 @@ describe.skipIf(!SHOULD_RUN)("python runner subprocess", () => {
}
});
it.skipIf(process.platform === "win32")("runs in its own POSIX session", async () => {
using tempDir = TempDir.createSync("@python-runner-session-isolation-");
const kernel = await PythonKernel.start({ cwd: tempDir.path() });
try {
const result = await executePythonWithKernel(kernel, "import os; print(os.getsid(0), os.getpid())");
const [sessionId, processId] = result.output.trim().split(/\s+/).map(Number);
expect(sessionId).toBe(processId);
} finally {
await kernel.shutdown();
}
});
it("cancels a long sleep via SIGINT within 500ms", async () => {
using tempDir = TempDir.createSync("@python-runner-cancel-");
const kernel = await PythonKernel.start({ cwd: tempDir.path() });