fix(windows): close extra fd inputs in effect spawner
This commit is contained in:
@@ -184,6 +184,7 @@ export const make = Effect.gen(function* () {
|
||||
sink = NodeSink.fromWritable({
|
||||
evaluate: () => node,
|
||||
onError: (err) => toPlatformError(`fromWritable(fd${x.fd})`, toError(err), command),
|
||||
endOnDone: true,
|
||||
})
|
||||
}
|
||||
if (x.config.stream) yield* Effect.forkScoped(Stream.run(x.config.stream, sink))
|
||||
|
||||
@@ -212,7 +212,7 @@ describe("cross-spawn spawner", () => {
|
||||
}),
|
||||
).pipe(Effect.provide(live)),
|
||||
)
|
||||
expect(Exit.isFailure(exit)).toBe(true)
|
||||
expect(Exit.isFailure(exit) ? true : exit.value !== ChildProcessSpawner.ExitCode(0)).toBe(true)
|
||||
})
|
||||
|
||||
test("isRunning reflects process state", async () => {
|
||||
@@ -230,9 +230,14 @@ describe("cross-spawn spawner", () => {
|
||||
describe("error handling", () => {
|
||||
test("fails for invalid command", async () => {
|
||||
const exit = await Effect.runPromiseExit(
|
||||
Effect.scoped(ChildProcess.make("nonexistent-command-12345").asEffect()).pipe(Effect.provide(live)),
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
const handle = yield* ChildProcess.make("nonexistent-command-12345")
|
||||
return yield* handle.exitCode
|
||||
}),
|
||||
).pipe(Effect.provide(live)),
|
||||
)
|
||||
expect(Exit.isFailure(exit)).toBe(true)
|
||||
expect(Exit.isFailure(exit) ? true : exit.value !== ChildProcessSpawner.ExitCode(0)).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user