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

Function getOSRelease

src/spec-common/injectHeadless.ts:411–425  ·  view source on GitHub ↗
(shellServer: ShellServer)

Source from the content-addressed store, hash-verified

409}
410
411export async function getOSRelease(shellServer: ShellServer) {
412 let hardware = 'unknown';
413 let id = 'unknown';
414 let version = 'unknown';
415 try {
416 hardware = (await shellServer.exec('uname -m')).stdout.trim();
417 const { stdout } = await shellServer.exec('(cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null');
418 id = (stdout.match(/^ID=([^\u001b\r\n]*)/m) || [])[1] || 'notfound';
419 version = (stdout.match(/^VERSION_ID=([^\u001b\r\n]*)/m) || [])[1] || 'notfound';
420 } catch (err) {
421 console.error(err);
422 // Optimistically continue.
423 }
424 return { hardware, id, version };
425}
426
427async function runPostCreateCommand(params: ResolverParameters, lifecycleCommandOriginMap: LifecycleHooksInstallMap, containerProperties: ContainerProperties, postCommandName: 'onCreateCommand' | 'updateContentCommand' | 'postCreateCommand', remoteEnv: Promise<Record<string, string>>, secrets: Promise<Record<string, string>>, rerun: boolean) {
428 const markerFile = path.posix.join(containerProperties.userDataFolder, `.${postCommandName}Marker`);

Callers 1

getContainerPropertiesFunction · 0.85

Calls 1

execMethod · 0.65

Tested by

no test coverage detected