Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/internal/child_process/serialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
const {
JSONParse,
JSONStringify,
StringPrototypeSplit,
Symbol,
TypedArrayPrototypeSubarray,
} = primordials;
const { Buffer } = require('buffer');
const { StringDecoder } = require('string_decoder');
Expand Down Expand Up @@ -63,8 +65,8 @@ const advanced = {
}

const deserializer = new ChildProcessDeserializer(
messageBuffer.subarray(4, 4 + size));
messageBuffer = messageBuffer.subarray(4 + size);
TypedArrayPrototypeSubarray(messageBuffer, 4, 4 + size));
messageBuffer = TypedArrayPrototypeSubarray(messageBuffer, 4 + size);

deserializer.readHeader();
yield deserializer.readValue();
Expand Down Expand Up @@ -98,7 +100,8 @@ const json = {

if (channel[kStringDecoder] === undefined)
channel[kStringDecoder] = new StringDecoder('utf8');
const chunks = channel[kStringDecoder].write(readData).split('\n');
const chunks =
StringPrototypeSplit(channel[kStringDecoder].write(readData), '\n');
const numCompleteChunks = chunks.length - 1;
// Last line does not have trailing linebreak
const incompleteChunk = chunks[numCompleteChunks];
Expand Down