MCPcopy
hub / github.com/coder/mux / startWorkspace

Method startWorkspace

src/node/services/coderService.ts:1196–1218  ·  view source on GitHub ↗

* 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 }
  )

Source from the content-addressed store, hash-verified

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.

Callers 1

createCoderUnarchiveHookFunction · 0.80

Calls 5

runCoderCommandMethod · 0.95
ErrFunction · 0.90
OkFunction · 0.90
getErrorMessageFunction · 0.90
interpretCoderResultFunction · 0.85

Tested by

no test coverage detected