From aecdec3f800b3458296ad323ffbdab9cc3fc9524 Mon Sep 17 00:00:00 2001 From: Chinesezjc Date: Tue, 25 Aug 2026 13:50:00 +0800 Subject: [PATCH] fix(code-runtime-python): guard the stdin destroy against a spawn-failure child The boot-write-failure path's fake child carries no stdin handle, so the unconditional destroy threw inside the spawn error handler and mislabeled the worker-exit. Use the optional-call form; the no-stdin branch is exercised by that same test. --- packages/code-runtime/code-runtime-python/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/code-runtime/code-runtime-python/src/index.ts b/packages/code-runtime/code-runtime-python/src/index.ts index a614261db8..dc56a8bb0e 100644 --- a/packages/code-runtime/code-runtime-python/src/index.ts +++ b/packages/code-runtime/code-runtime-python/src/index.ts @@ -995,7 +995,7 @@ export class PythonCodeRuntime extends CodeRuntime { // inheriting fd 0 would keep the host process from exiting even after the // closeDeadline forced settlement. The child (and any descendant) reads // EOF on fd 0 instead, and no host handle survives. - child.stdin.destroy() + child.stdin?.destroy() } catch (error: unknown) { try { rmSync(bootstrapDir, { recursive: true, force: true })