We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 398d58f commit bc3f568Copy full SHA for bc3f568
1 file changed
src/shared/fs-atomic-fix.ts
@@ -0,0 +1,19 @@
1
+import fs from "fs";
2
+
3
+/**
4
+ * Handles EPERM issues during chmod on Windows-mounted Docker volumes.
5
+ * Addresses #53947.
6
+ */
7
+export function writeTextFileAtomicSync(pathname: string, value: string, mode: number = 0o600) {
8
+ const tempPath = `${pathname}.tmp-${process.pid}-${Date.now()}`;
9
+ fs.writeFileSync(tempPath, value, "utf8");
10
11
+ try {
12
+ // This fails on Windows-mounted volumes in Docker
13
+ fs.chmodSync(tempPath, mode);
14
+ } catch (e) {
15
+ // Silently continue if chmod fails (EPERM expected on NTFS/CIFS mounts)
16
+ }
17
18
+ fs.renameSync(tempPath, pathname);
19
+}
0 commit comments