MCPcopy Index your code
hub / github.com/devcontainers/cli / getHomeFolder

Function getHomeFolder

src/spec-common/injectHeadless.ts:281–294  ·  view source on GitHub ↗
(shellServer: ShellServer, containerEnv: NodeJS.ProcessEnv, passwdUser: PasswdUser | undefined)

Source from the content-addressed store, hash-verified

279}
280
281export async function getHomeFolder(shellServer: ShellServer, containerEnv: NodeJS.ProcessEnv, passwdUser: PasswdUser | undefined) {
282 if (containerEnv.HOME) {
283 if (containerEnv.HOME === passwdUser?.home || passwdUser?.uid === '0') {
284 return containerEnv.HOME;
285 }
286 try {
287 await shellServer.exec(`[ ! -e '${containerEnv.HOME}' ] || [ -w '${containerEnv.HOME}' ]`);
288 return containerEnv.HOME;
289 } catch {
290 // Exists but not writable.
291 }
292 }
293 return passwdUser?.home || '/root';
294}
295
296async function getUserShell(containerEnv: NodeJS.ProcessEnv, passwdUser: PasswdUser | undefined) {
297 return containerEnv.SHELL || (passwdUser && passwdUser.shell) || '/bin/sh';

Callers 2

getContainerPropertiesFunction · 0.85

Calls 1

execMethod · 0.65

Tested by

no test coverage detected