24 lines
624 B
TypeScript
24 lines
624 B
TypeScript
|
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;
|
||
|
}
|