define-alpine-the-sequel/helpers/repro-run.ts

24 lines
624 B
TypeScript
Raw Normal View History

2023-02-08 14:46:33 +00:00
import { Writable } from "node:stream";
import { execFile } from "./better-api.js";
export async function reproRun(opts: {
// cwd stores the code available inside the container as /src, and also
// cache/ and rootfs/
cwd: string;
command: string;
cache: string[];
}): Promise<void> {
const run = execFile("repro-run", { cwd: opts.cwd });
if (!run.child.stdin) throw false;
run.child.stdin.write(
JSON.stringify({
Command: opts.command,
Cache: opts.cache,
})
);
run.child.stdin.end();
run.child.stdout?.pipe(process.stdout);
run.child.stderr?.pipe(process.stderr);
await run;
}