Skip to content

Commit 1dbb30b

Browse files
committed
fix(windows): fileSync
1 parent c702308 commit 1dbb30b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/common/file-system.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,12 @@ export class FileSystem implements IFileSystem {
432432
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, delayMs * attempt);
433433
continue;
434434
}
435-
// If a sync lock on newly-created directories long enough
436-
// that rename never succeeds even after retries. Fall back to a
437-
// recursive copy + delete, which doesn't require an atomic rename and
438-
// is immune to the lock (individual file reads/writes still succeed).
435+
436+
// Use fs.cpSync rather than this.copyFile: shelljs cp places src as a
437+
// child of dest when dest already exists, whereas cpSync always writes
438+
// to the dest path itself regardless of whether it pre-exists.
439439
if (e.code === "EPERM" && process.platform === "win32") {
440-
this.copyFile(oldPath, newPath);
440+
fs.cpSync(oldPath, newPath, { recursive: true });
441441
this.deleteDirectory(oldPath);
442442
return;
443443
}

0 commit comments

Comments
 (0)