| 205 | } |
| 206 | |
| 207 | private spawnProcess( |
| 208 | command: string, |
| 209 | opts?: ProcessOptions, |
| 210 | ): Promise<SpawnHandle> { |
| 211 | const stream = this.client.exec(this.name, { |
| 212 | argv: ['bash', '-c', command], |
| 213 | cwd: opts?.cwd ? this.abs(opts.cwd) : this.workdir, |
| 214 | env: this.mergedEnv(opts?.env), |
| 215 | ...(opts?.signal ? { signal: opts.signal } : {}), |
| 216 | }) |
| 217 | return Promise.resolve({ |
| 218 | pid: -1, // Sprite exec sessions do not surface a host-visible pid. |
| 219 | stdout: stream.stdout, |
| 220 | stderr: stream.stderr, |
| 221 | stdin: { |
| 222 | write: () => |
| 223 | Promise.reject( |
| 224 | new Error( |
| 225 | 'sprites: background process stdin is not writable (see capabilities.writableStdin)', |
| 226 | ), |
| 227 | ), |
| 228 | end: () => Promise.resolve(), |
| 229 | }, |
| 230 | wait: () => stream.wait(), |
| 231 | kill: () => stream.kill(), |
| 232 | }) |
| 233 | } |
| 234 | |
| 235 | private connectPort(port: number): Promise<SandboxChannel> { |
| 236 | if (port !== this.httpPort) { |