From f29aa482916b0fdba2270ba185a9096b9849349f Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Sun, 24 Jul 2022 21:33:27 +0200 Subject: [PATCH 1/2] Fix atomic writestream handling on Windows --- packages/core/fs/src/NodeFS.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/fs/src/NodeFS.js b/packages/core/fs/src/NodeFS.js index 263d036fc05..50d80009a18 100644 --- a/packages/core/fs/src/NodeFS.js +++ b/packages/core/fs/src/NodeFS.js @@ -14,7 +14,7 @@ import nativeFS from 'fs'; import ncp from 'ncp'; import {promisify} from 'util'; import {registerSerializableClass} from '@parcel/core'; -import {hashStream} from '@parcel/utils'; +import {hashFile} from '@parcel/utils'; import watcher from '@parcel/watcher'; import packageJSON from '../package.json'; @@ -77,11 +77,11 @@ export class NodeFS implements FileSystem { e.code === 'EPERM' ) { let [hashTmp, hashTarget] = await Promise.all([ - hashStream(writeStream.__atomicTmp), - hashStream(writeStream.__atomicTarget), + hashFile(tmpFilePath), + hashFile(filePath), ]); - await this.unlink(writeStream.__atomicTmp); + await this.unlink(tmpFilePath); if (hashTmp != hashTarget) { throw e; From 41ed211ba84582f9b8c4b06f7f6d5b18babb0e20 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Tue, 26 Jul 2022 13:37:28 +0200 Subject: [PATCH 2/2] Update NodeFS.js --- packages/core/fs/src/NodeFS.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/fs/src/NodeFS.js b/packages/core/fs/src/NodeFS.js index 50d80009a18..276ac4ac91c 100644 --- a/packages/core/fs/src/NodeFS.js +++ b/packages/core/fs/src/NodeFS.js @@ -77,8 +77,8 @@ export class NodeFS implements FileSystem { e.code === 'EPERM' ) { let [hashTmp, hashTarget] = await Promise.all([ - hashFile(tmpFilePath), - hashFile(filePath), + hashFile(this, tmpFilePath), + hashFile(this, filePath), ]); await this.unlink(tmpFilePath);