MCPcopy Create free account
hub / github.com/devcontainers/cli / readUserEnvFromCache

Function readUserEnvFromCache

src/spec-common/injectHeadless.ts:798–815  ·  view source on GitHub ↗
(userEnvProbe: UserEnvProbe, params: { output: Log; containerSessionDataFolder?: string }, shellServer?: ShellServer)

Source from the content-addressed store, hash-verified

796}
797
798async function readUserEnvFromCache(userEnvProbe: UserEnvProbe, params: { output: Log; containerSessionDataFolder?: string }, shellServer?: ShellServer) {
799 if (!shellServer || !params.containerSessionDataFolder) {
800 return undefined;
801 }
802
803 const cacheFile = getUserEnvCacheFilePath(userEnvProbe, params.containerSessionDataFolder);
804 try {
805 if (await isFile(shellServer, cacheFile)) {
806 const { stdout } = await shellServer.exec(`cat '${cacheFile}'`);
807 return JSON.parse(stdout);
808 }
809 }
810 catch (e) {
811 params.output.write(`Failed to read/parse user env cache: ${e}`, LogLevel.Error);
812 }
813
814 return undefined;
815}
816
817async function updateUserEnvCache(env: Record<string, string>, userEnvProbe: UserEnvProbe, params: { output: Log; containerSessionDataFolder?: string }, shellServer?: ShellServer) {
818 if (!shellServer || !params.containerSessionDataFolder) {

Callers 1

probeUserEnvFunction · 0.85

Calls 4

isFileFunction · 0.90
getUserEnvCacheFilePathFunction · 0.85
execMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected