Add support for running rust-cache commands from within a Nix shell (#290)

This commit is contained in:
marc0246
2025-12-01 19:56:12 +01:00
committed by GitHub
parent 779680da71
commit 151eeee51b
10 changed files with 167 additions and 43 deletions

View File

@@ -16,14 +16,15 @@ export function reportError(e: any) {
}
export async function getCmdOutput(
cmdFormat: string,
cmd: string,
args: Array<string> = [],
options: exec.ExecOptions = {},
): Promise<string> {
cmd = cmdFormat.replace("{0}", cmd);
let stdout = "";
let stderr = "";
try {
await exec.exec(cmd, args, {
await exec.exec(cmd, [], {
silent: true,
listeners: {
stdout(data) {
@@ -37,7 +38,7 @@ export async function getCmdOutput(
});
} catch (e) {
(e as any).commandFailed = {
command: `${cmd} ${args.join(" ")}`,
command: cmd,
stderr,
};
throw e;