(input)
| 283 | resolveSpawnCommand(command, args, env ? { env } : {}); |
| 284 | |
| 285 | const runOpenCodeCommand: OpenCodeRuntimeShape["runOpenCodeCommand"] = (input) => |
| 286 | Effect.gen(function* () { |
| 287 | const spawnCommand = yield* resolveCommand(input.binaryPath, input.args, input.environment); |
| 288 | const child = yield* spawner.spawn( |
| 289 | ChildProcess.make(spawnCommand.command, spawnCommand.args, { |
| 290 | shell: spawnCommand.shell, |
| 291 | ...(input.environment ? { env: input.environment } : { extendEnv: true }), |
| 292 | }), |
| 293 | ); |
| 294 | const [stdout, stderr, code] = yield* Effect.all( |
| 295 | [collectStreamAsString(child.stdout), collectStreamAsString(child.stderr), child.exitCode], |
| 296 | { concurrency: "unbounded" }, |
| 297 | ); |
| 298 | const exitCode = Number(code); |
| 299 | if (yield* isWindowsCommandNotFound(exitCode, stderr)) { |
| 300 | return yield* new OpenCodeRuntimeError({ |
| 301 | operation: "runOpenCodeCommand", |
| 302 | detail: `spawn ${input.binaryPath} ENOENT`, |
| 303 | }); |
| 304 | } |
| 305 | return { |
| 306 | stdout, |
| 307 | stderr, |
| 308 | code: exitCode, |
| 309 | } satisfies OpenCodeCommandResult; |
| 310 | }).pipe( |
| 311 | Effect.scoped, |
| 312 | Effect.mapError((cause) => |
| 313 | ensureRuntimeError( |
| 314 | "runOpenCodeCommand", |
| 315 | `Failed to execute '${input.binaryPath} ${input.args.join(" ")}': ${openCodeRuntimeErrorDetail(cause)}`, |
| 316 | cause, |
| 317 | ), |
| 318 | ), |
| 319 | ); |
| 320 | |
| 321 | const startOpenCodeServerProcess: OpenCodeRuntimeShape["startOpenCodeServerProcess"] = (input) => |
| 322 | Effect.gen(function* () { |
nothing calls this directly
no test coverage detected