Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
worker: refactor to avoid unsafe array iteration
PR-URL: #37346
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Harshitha K P <harshitha014@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
aduh95 authored and targos committed Jun 11, 2021
1 parent 9417fd0 commit 698bffa
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 @@ -181,8 +182,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 698bffa

Please sign in to comment.