MCPcopy Index your code
hub / github.com/coder/mux / ensureDirViaExec

Method ensureDirViaExec

src/node/runtime/DevcontainerRuntime.ts:405–427  ·  view source on GitHub ↗
(dirPath: string, abortSignal?: AbortSignal)

Source from the content-addressed store, hash-verified

403 }
404
405 private async ensureDirViaExec(dirPath: string, abortSignal?: AbortSignal): Promise<void> {
406 const stream = await this.exec(`mkdir -p ${this.quoteForContainer(dirPath)}`, {
407 cwd: "/",
408 timeout: 10,
409 abortSignal,
410 });
411
412 await stream.stdin.close();
413
414 const [stdout, stderr, exitCode] = await Promise.all([
415 streamToString(stream.stdout),
416 streamToString(stream.stderr),
417 stream.exitCode,
418 ]);
419
420 if (exitCode !== 0) {
421 const extra = stderr.trim() || stdout.trim();
422 throw new RuntimeError(
423 `Failed to create directory ${dirPath}: exit code ${exitCode}${extra ? `: ${extra}` : ""}`,
424 "file_io"
425 );
426 }
427 }
428
429 private async statViaExec(filePath: string, abortSignal?: AbortSignal): Promise<FileStat> {
430 // -L follows symlinks so symlinked paths report the target's type

Callers 1

ensureDirMethod · 0.95

Calls 4

execMethod · 0.95
quoteForContainerMethod · 0.95
streamToStringFunction · 0.90
closeMethod · 0.65

Tested by

no test coverage detected