(input: StartCommandInput)
| 217 | } |
| 218 | |
| 219 | async start(input: StartCommandInput): Promise<ProcessSnapshot> { |
| 220 | const session = this.createSession(input); |
| 221 | this.sessions.set(session.id, session); |
| 222 | |
| 223 | try { |
| 224 | if (input.tty && process.platform !== "win32") await this.startPty(session, input); |
| 225 | else this.startPipe(session, input); |
| 226 | } catch (error) { |
| 227 | this.sessions.delete(session.id); |
| 228 | throw error; |
| 229 | } |
| 230 | |
| 231 | const yieldTimeMs = boundedInteger(input.yieldTimeMs, DEFAULT_EXEC_YIELD_MS, MAX_COMMAND_YIELD_MS); |
| 232 | await this.waitForExit(session, yieldTimeMs); |
| 233 | |
| 234 | const snapshot = this.consume(session, input.maxOutputTokens); |
| 235 | if (!session.running) this.removeSession(session.id); |
| 236 | return snapshot; |
| 237 | } |
| 238 | |
| 239 | async write(input: WriteStdinInput): Promise<ProcessSnapshot> { |
| 240 | const session = this.getOwnedSession(input.workspaceId, input.sessionId); |
no test coverage detected