| 52 | } |
| 53 | |
| 54 | class TimeoutError extends Error { |
| 55 | constructor(command: string, timeoutMs: number) { |
| 56 | super( |
| 57 | `Command timed out after ${timeoutMs / 1000}s: ${command.slice(0, 100)}${command.length > 100 ? '...' : ''}`, |
| 58 | ); |
| 59 | this.name = 'TimeoutError'; |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // Wrapper that adds timeout to bash commands |
| 64 | function withTimeout<T>(promise: Promise<T>, timeoutMs: number, command: string): Promise<T> { |
nothing calls this directly
no outgoing calls
no test coverage detected