fix: support Windows agent command shims
This commit is contained in:
+3
-3
@@ -1,4 +1,3 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { constants } from "node:fs";
|
||||
import { copyFile, cp, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
||||
@@ -6,6 +5,7 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { createInterface } from "node:readline/promises";
|
||||
import { applyEdits, modify, parse } from "jsonc-parser";
|
||||
import spawn from "cross-spawn";
|
||||
import type { ClientOptions } from "./config.js";
|
||||
import { errorMessage } from "./config.js";
|
||||
|
||||
@@ -383,8 +383,8 @@ export class SpawnCommandRunner implements CommandRunner {
|
||||
const child = spawn(command, args, { shell: false, windowsHide: true, stdio: ["ignore", "pipe", "pipe"] });
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
child.stdout.setEncoding("utf8").on("data", (chunk) => { stdout += String(chunk); });
|
||||
child.stderr.setEncoding("utf8").on("data", (chunk) => { stderr += String(chunk); });
|
||||
child.stdout?.setEncoding("utf8").on("data", (chunk) => { stdout += String(chunk); });
|
||||
child.stderr?.setEncoding("utf8").on("data", (chunk) => { stderr += String(chunk); });
|
||||
child.once("error", (error) => reject(new Error(`Could not run ${command}: ${errorMessage(error)}`)));
|
||||
child.once("close", (code) => resolve({ code: code ?? 1, stdout, stderr }));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user