buffer stdin lines in deno dedicated worker wrapper to prevent chunk splitting (#8533)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-03-25 21:51:51 +00:00
committed by GitHub
parent b7475c7309
commit 36a81004dc

View File

@@ -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;