diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js index 7734aaa2c2011c..36c5d4c5675413 100644 --- a/lib/internal/main/worker_thread.js +++ b/lib/internal/main/worker_thread.js @@ -5,6 +5,7 @@ const { ArrayPrototypeConcat, + ArrayPrototypeForEach, ArrayPrototypeSplice, ObjectDefineProperty, PromisePrototypeCatch, @@ -178,8 +179,9 @@ port.on('message', (message) => { } } else if (message.type === STDIO_PAYLOAD) { const { stream, chunks } = message; - for (const { chunk, encoding } of chunks) + ArrayPrototypeForEach(chunks, ({ chunk, encoding }) => { process[stream].push(chunk, encoding); + }); } else { assert( message.type === STDIO_WANTS_MORE_DATA,