| ... | ... | @@ -93,23 +93,24 @@ export const BunPtyAdapterLive = Layer.effect( |
| 93 | 93 | return yield* Effect.die("Bun PTY terminal support is unavailable on Windows."); |
| 94 | 94 | } |
| 95 | 95 | return { |
| 96 | | spawn: (input) => { |
| 97 | | let processHandle: BunPtyProcess | null = null; |
| 98 | | const command = [input.shell, ...(input.args ?? [])]; |
| 99 | | const subprocess = Bun.spawn(command, { |
| 100 | | cwd: input.cwd, |
| 101 | | env: input.env, |
| 102 | | terminal: { |
| 103 | | cols: input.cols, |
| 104 | | rows: input.rows, |
| 105 | | data: (_terminal, data) => { |
| 106 | | processHandle?.emitData(data); |
| 96 | spawn: (input) => |
| 97 | Effect.sync(() => { |
| 98 | let processHandle: BunPtyProcess | null = null; |
| 99 | const command = [input.shell, ...(input.args ?? [])]; |
| 100 | const subprocess = Bun.spawn(command, { |
| 101 | cwd: input.cwd, |
| 102 | env: input.env, |
| 103 | terminal: { |
| 104 | cols: input.cols, |
| 105 | rows: input.rows, |
| 106 | data: (_terminal, data) => { |
| 107 | processHandle?.emitData(data); |
| 108 | }, |
| 107 | 109 | }, |
| 108 | | }, |
| 109 | | }); |
| 110 | | processHandle = new BunPtyProcess(subprocess); |
| 111 | | return Effect.succeed(processHandle); |
| 112 | | }, |
| 110 | }); |
| 111 | processHandle = new BunPtyProcess(subprocess); |
| 112 | return processHandle; |
| 113 | }), |
| 113 | 114 | } satisfies PtyAdapterShape; |
| 114 | 115 | }), |
| 115 | 116 | ); |