| 169 | } |
| 170 | |
| 171 | const spawn = ( |
| 172 | command: ChildProcess.StandardCommand, |
| 173 | executable: string, |
| 174 | args: ReadonlyArray<string>, |
| 175 | options: Deno.CommandOptions |
| 176 | ) => |
| 177 | Effect.try({ |
| 178 | try: () => { |
| 179 | const childProcess = new Deno.Command(executable, { ...options, args: [...args] }).spawn() |
| 180 | const exitSignal = Deferred.makeUnsafe<Deno.CommandStatus, PlatformError.PlatformError>() |
| 181 | childProcess.status.then( |
| 182 | (status) => Deferred.doneUnsafe(exitSignal, Exit.succeed(status)), |
| 183 | (cause) => Deferred.doneUnsafe(exitSignal, Exit.fail(toPlatformError("status", cause, command))) |
| 184 | ) |
| 185 | return [childProcess, exitSignal] as const |
| 186 | }, |
| 187 | catch: (cause) => toPlatformError("spawn", cause, command) |
| 188 | }) |
| 189 | |
| 190 | const killProcess = ( |
| 191 | command: ChildProcess.StandardCommand, |