From 36a81004dcdd9b9faea0402f431f36678063624e Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 25 Mar 2026 21:51:51 +0000 Subject: [PATCH] buffer stdin lines in deno dedicated worker wrapper to prevent chunk splitting (#8533) Co-authored-by: Claude Opus 4.6 (1M context) --- backend/windmill-worker/src/deno_executor.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/windmill-worker/src/deno_executor.rs b/backend/windmill-worker/src/deno_executor.rs index a0fd9fdde8..3013d10689 100644 --- a/backend/windmill-worker/src/deno_executor.rs +++ b/backend/windmill-worker/src/deno_executor.rs @@ -672,10 +672,15 @@ BigInt.prototype.toJSON = function () {{ console.log('start\n'); const decoder = new TextDecoder(); +let _buffer = ""; for await (const chunk of Deno.stdin.readable) {{ - const lines = decoder.decode(chunk); + _buffer += decoder.decode(chunk, {{ stream: true }}); + const _parts = _buffer.split("\n"); + _buffer = _parts.pop() ?? ""; let exit = false; - for (const line of lines.trim().split("\n")) {{ + for (const _part of _parts) {{ + const line = _part.trim(); + if (!line) continue; if (line === "end") {{ exit = true; break;