Skip to content

Commit 481d772

Browse files
authored
Let OS choose tmpfs size (#150)
1 parent 21a6c64 commit 481d772

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/utils/overlayFS.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import fs from "fs";
12
import path from "path";
23
import { execAsync } from "./execUtils";
34

@@ -24,7 +25,7 @@ export async function createTempOverlayFS(root: string, diagnosticOutput: boolea
2425
await tryUnmount(root);
2526
await rmWithRetryAsRoot(root);
2627
await mkdirAllAsRoot(root);
27-
await execAsync(processCwd, `sudo mount -t tmpfs -o size=4g tmpfs ${root}`);
28+
await execAsync(processCwd, `sudo mount -t tmpfs tmpfs ${root}`);
2829

2930
const lowerDir = path.join(root, "base");
3031
await mkdirAll(lowerDir);
@@ -99,10 +100,12 @@ async function retry(fn: (() => void) | (() => Promise<void>), retries: number,
99100
}
100101

101102
async function tryUnmount(p: string) {
103+
if (!fs.existsSync(p)) return;
102104
try {
103105
await execAsync(processCwd, `sudo umount -R ${p}`)
104106
} catch {
105-
// ignore
107+
// Print out handles for debugging.
108+
await execAsync(processCwd, `sudo lsof ${p}`)
106109
}
107110
}
108111

0 commit comments

Comments
 (0)