* Start a Coder workspace. * * Uses spawn + timeout so callers don't hang forever on a stuck CLI invocation.
(
workspaceName: string,
options?: { timeoutMs?: number; signal?: AbortSignal }
)
| 1194 | * Uses spawn + timeout so callers don't hang forever on a stuck CLI invocation. |
| 1195 | */ |
| 1196 | async startWorkspace( |
| 1197 | workspaceName: string, |
| 1198 | options?: { timeoutMs?: number; signal?: AbortSignal } |
| 1199 | ): Promise<Result<void>> { |
| 1200 | const timeoutMs = options?.timeoutMs ?? 60_000; |
| 1201 | |
| 1202 | try { |
| 1203 | const result = await this.runCoderCommand(["start", workspaceName, "--yes"], { |
| 1204 | timeoutMs, |
| 1205 | signal: options?.signal, |
| 1206 | }); |
| 1207 | |
| 1208 | const interpreted = interpretCoderResult(result); |
| 1209 | if (!interpreted.ok) { |
| 1210 | return Err(interpreted.error); |
| 1211 | } |
| 1212 | |
| 1213 | return Ok(undefined); |
| 1214 | } catch (error) { |
| 1215 | const message = getErrorMessage(error); |
| 1216 | return Err(message); |
| 1217 | } |
| 1218 | } |
| 1219 | |
| 1220 | /** |
| 1221 | * Stop a Coder workspace. |
no test coverage detected