mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 22:32:28 +00:00
sync
This commit is contained in:
28
packages/opencode/src/bun/index.ts
Normal file
28
packages/opencode/src/bun/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import path from "path";
|
||||
import { Log } from "../util/log";
|
||||
export namespace BunProc {
|
||||
const log = Log.create({ service: "bun" });
|
||||
|
||||
export function run(
|
||||
cmd: string[],
|
||||
options?: Bun.SpawnOptions.OptionsObject<any, any, any>,
|
||||
) {
|
||||
const root =
|
||||
process.argv0 !== "bun"
|
||||
? path.resolve(process.cwd(), process.argv0)
|
||||
: process.argv0;
|
||||
log.info("running", {
|
||||
cmd: [root, ...cmd],
|
||||
options,
|
||||
});
|
||||
const result = Bun.spawnSync([root, ...cmd], {
|
||||
...options,
|
||||
argv0: "bun",
|
||||
env: {
|
||||
...process.env,
|
||||
...options?.env,
|
||||
},
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user