From 28e39c57bd479034bc12de0026d68e77512a2be4 Mon Sep 17 00:00:00 2001 From: Jade <2364004+Blu-J@users.noreply.github.com> Date: Mon, 21 Oct 2024 14:47:09 -0600 Subject: [PATCH] Fix: Error Messages in HealthCheck (#2759) * Fix: Error Messages in HealthCheck * Update sdk/package/lib/util/SubContainer.ts Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> * fix ts error --------- Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> Co-authored-by: Aiden McClelland --- sdk/package/lib/util/SubContainer.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/sdk/package/lib/util/SubContainer.ts b/sdk/package/lib/util/SubContainer.ts index 16476f564..be1491050 100644 --- a/sdk/package/lib/util/SubContainer.ts +++ b/sdk/package/lib/util/SubContainer.ts @@ -258,18 +258,12 @@ export class SubContainer implements ExecSpawnable { await new Promise((resolve) => child.stdin.end(resolve)) } const pid = child.pid - const stdout = { data: "" as string | Buffer } - const stderr = { data: "" as string | Buffer } + const stdout = { data: "" as string } + const stderr = { data: "" as string } const appendData = - (appendTo: { data: string | Buffer }) => - (chunk: string | Buffer | any) => { - if (typeof appendTo.data === "string" && typeof chunk === "string") { - appendTo.data += chunk - } else if (typeof chunk === "string" || chunk instanceof Buffer) { - appendTo.data = Buffer.concat([ - new Uint8Array(Buffer.from(appendTo.data).buffer), - new Uint8Array(Buffer.from(chunk).buffer), - ]) + (appendTo: { data: string }) => (chunk: string | Buffer | any) => { + if (typeof chunk === "string" || chunk instanceof Buffer) { + appendTo.data += chunk.toString() } else { console.error("received unexpected chunk", chunk) }