fix: bound trans stdout and sanitize win ps json
This commit is contained in:
+11
-1
@@ -8,6 +8,7 @@ import { summarizeMicroserviceHealthResponse, summarizeMicroserviceObservation,
|
||||
import { parseNetworkPerfOptions, runNetworkPerf } from "./network-perf";
|
||||
import {
|
||||
buildWindowsPowerShellInvocation,
|
||||
createSshStdoutForwarder,
|
||||
formatSshFailureHint,
|
||||
formatSshRuntimeTimeoutHint,
|
||||
formatSshRuntimeTimingHint,
|
||||
@@ -985,6 +986,10 @@ async function runRemoteSshWebSocket(
|
||||
|
||||
return await new Promise<number>((resolve) => {
|
||||
const rawMode = parsed.remoteCommand === null && process.stdin.isTTY && typeof process.stdin.setRawMode === "function";
|
||||
const stdoutForwarder = parsed.remoteCommand === null ? null : createSshStdoutForwarder({
|
||||
invocation,
|
||||
transport: "frontend-websocket",
|
||||
});
|
||||
let timedOut = false;
|
||||
const openTimer = setTimeout(() => {
|
||||
if (sessionReady || settled) return;
|
||||
@@ -1068,7 +1073,12 @@ async function runRemoteSshWebSocket(
|
||||
if (message.type === "ssh.data") {
|
||||
const chunk = Buffer.from(String(message.data ?? ""), message.encoding === "base64" ? "base64" : "utf8");
|
||||
if (message.stream === "stderr") process.stderr.write(chunk);
|
||||
else process.stdout.write(chunk);
|
||||
else if (stdoutForwarder === null) {
|
||||
process.stdout.write(chunk);
|
||||
} else {
|
||||
const hint = stdoutForwarder.write(chunk);
|
||||
if (hint !== null) process.stderr.write(hint);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (message.type === "ssh.error") {
|
||||
|
||||
Reference in New Issue
Block a user