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

Function getLocalUsername

src/spec-common/commonUtils.ts:574–590  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

572
573let localUsername: Promise<string>;
574export async function getLocalUsername() {
575 if (localUsername === undefined) {
576 localUsername = (async () => {
577 try {
578 return os.userInfo().username;
579 } catch (err) {
580 if (process.platform !== 'linux') {
581 throw err;
582 }
583 // os.userInfo() fails with VS Code snap install: https://github.com/microsoft/vscode-remote-release/issues/6913
584 const result = await runCommandNoPty({ exec: plainExec(undefined), cmd: 'id', args: ['-u', '-n'], output: nullLog });
585 return result.stdout.toString().trim();
586 }
587 })();
588 }
589 return localUsername;
590}
591
592export function getEntPasswdShellCommand(userNameOrId: string) {
593 const escapedForShell = userNameOrId.replace(/['\\]/g, '\\$&');

Callers 1

getLocalCacheFolderFunction · 0.90

Calls 2

runCommandNoPtyFunction · 0.85
plainExecFunction · 0.85

Tested by

no test coverage detected