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

Method stopWorkspace

src/node/services/coderService.ts:1225–1247  ·  view source on GitHub ↗

* Stop 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

1223 * Uses spawn + timeout so callers don't hang forever on a stuck CLI invocation.
1224 */
1225 async stopWorkspace(
1226 workspaceName: string,
1227 options?: { timeoutMs?: number; signal?: AbortSignal }
1228 ): Promise<Result<void>> {
1229 const timeoutMs = options?.timeoutMs ?? 60_000;
1230
1231 try {
1232 const result = await this.runCoderCommand(["stop", workspaceName, "--yes"], {
1233 timeoutMs,
1234 signal: options?.signal,
1235 });
1236
1237 const interpreted = interpretCoderResult(result);
1238 if (!interpreted.ok) {
1239 return Err(interpreted.error);
1240 }
1241
1242 return Ok(undefined);
1243 } catch (error) {
1244 const message = getErrorMessage(error);
1245 return Err(message);
1246 }
1247 }
1248
1249 /**
1250 * Wait for Coder workspace startup scripts to complete.

Callers 1

createCoderArchiveHookFunction · 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