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

Method fetchRemoteHome

src/node/runtime/DevcontainerRuntime.ts:270–288  ·  view source on GitHub ↗
(abortSignal?: AbortSignal)

Source from the content-addressed store, hash-verified

268 }
269
270 private async fetchRemoteHome(abortSignal?: AbortSignal): Promise<void> {
271 if (!this.currentWorkspacePath) return;
272 if (abortSignal?.aborted) return;
273 try {
274 const stream = await this.exec('printf "%s" "$HOME"', {
275 cwd: this.remoteWorkspaceFolder ?? "/",
276 timeout: 10,
277 abortSignal,
278 });
279 await stream.stdin.close();
280 const stdout = await streamToString(stream.stdout);
281 const exitCode = await stream.exitCode;
282 if (exitCode === 0 && stdout.trim()) {
283 this.remoteHomeDir = stdout.trim();
284 }
285 } catch {
286 // Best-effort; keep going if $HOME cannot be resolved
287 }
288 }
289
290 private readFileViaExec(filePath: string, abortSignal?: AbortSignal): ReadableStream<Uint8Array> {
291 return new ReadableStream<Uint8Array>({

Callers 3

postCreateSetupMethod · 0.95
resolvePathMethod · 0.95
ensureReadyMethod · 0.95

Calls 3

execMethod · 0.95
streamToStringFunction · 0.90
closeMethod · 0.65

Tested by

no test coverage detected