Skip to content

Commit

Permalink
worker: refactor to avoid unsafe array iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Feb 13, 2021
1 parent 521c08d commit af0133c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/internal/main/worker_thread.js
Expand Up @@ -5,6 +5,7 @@

const {
ArrayPrototypeConcat,
ArrayPrototypeForEach,
ArrayPrototypeSplice,
ObjectDefineProperty,
PromisePrototypeCatch,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit af0133c

Please sign in to comment.