(record: TerminalSessionRecord, reason: 'started' | 'restarted')
| 94 | } |
| 95 | |
| 96 | function ensureProcessStarted(record: TerminalSessionRecord, reason: 'started' | 'restarted') { |
| 97 | if (record.process) { |
| 98 | return Promise.resolve() |
| 99 | } |
| 100 | |
| 101 | if (record.restartPromise) { |
| 102 | return record.restartPromise |
| 103 | } |
| 104 | |
| 105 | record.restartPromise = startProcess(record, reason).finally(() => { |
| 106 | record.restartPromise = null |
| 107 | }) |
| 108 | return record.restartPromise |
| 109 | } |
| 110 | |
| 111 | export async function openTerminal(request: TerminalOpenRequest): Promise<TerminalSessionSnapshot> { |
| 112 | const cwd = request.cwd ?? request.projectId |
no test coverage detected