Skip to content

Commit 328e8c1

Browse files
committed
fix: cache
1 parent e13a3d2 commit 328e8c1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/common/container.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import fs from "fs/promises";
22

3-
export async function detectContainerEnv(): Promise<boolean> {
3+
let containerEnv: boolean | undefined;
4+
5+
async function internalDetectContainerEnv(): Promise<boolean> {
46
if (process.platform !== "linux") {
57
return false; // we only support linux containers for now
68
}
@@ -22,3 +24,12 @@ export async function detectContainerEnv(): Promise<boolean> {
2224

2325
return exists.includes(true);
2426
}
27+
28+
export async function detectContainerEnv(): Promise<boolean> {
29+
if (containerEnv !== undefined) {
30+
return containerEnv;
31+
}
32+
33+
containerEnv = await internalDetectContainerEnv();
34+
return containerEnv;
35+
}

0 commit comments

Comments
 (0)