summaryrefslogtreecommitdiffhomepage
path: root/packages/opencode/src/effect/cross-spawn-spawner.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/opencode/src/effect/cross-spawn-spawner.ts')
-rw-r--r--packages/opencode/src/effect/cross-spawn-spawner.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/opencode/src/effect/cross-spawn-spawner.ts b/packages/opencode/src/effect/cross-spawn-spawner.ts
index 76982a613..5e25263a0 100644
--- a/packages/opencode/src/effect/cross-spawn-spawner.ts
+++ b/packages/opencode/src/effect/cross-spawn-spawner.ts
@@ -402,6 +402,7 @@ export const make = Effect.gen(function* () {
const fd = yield* setupFds(command, proc, extra)
const out = setupOutput(command, proc, sout, serr)
+ let ref = true
return makeHandle({
pid: ProcessId(proc.pid!),
stdin: yield* setupStdin(command, proc, sin),
@@ -432,6 +433,18 @@ export const make = Effect.gen(function* () {
orElse: () => send("SIGKILL").pipe(Effect.andThen(Deferred.await(signal)), Effect.asVoid),
})
},
+ unref: Effect.sync(() => {
+ if (ref) {
+ proc.unref()
+ ref = false
+ }
+ return Effect.sync(() => {
+ if (!ref) {
+ proc.ref()
+ ref = true
+ }
+ })
+ }),
})
}
case "PipedCommand": {