diff --git a/lib/stdio_protocol.ts b/lib/stdio_protocol.ts index 3e96a8679f2..945513f7a6f 100644 --- a/lib/stdio_protocol.ts +++ b/lib/stdio_protocol.ts @@ -352,7 +352,10 @@ else if (typeof Buffer !== 'undefined') { return buffer; }; - decodeUTF8 = bytes => Buffer.from(bytes).toString(); + decodeUTF8 = bytes => { + let { buffer, byteOffset, byteLength } = bytes; + return Buffer.from(buffer, byteOffset, byteLength).toString(); + } } else {