Skip to content

Commit

Permalink
fix(core): fix writing partial files to disk during migration (#9931)
Browse files Browse the repository at this point in the history
there can be a case where a readable stream will end but the piped writeable stream has not finished
writing to the disk
in which case you'll get partial file contents aka malformed json
ensure you
resolve the function after the writeable stream has finished writing to the disk
  • Loading branch information
barbados-clemens committed Apr 21, 2022
1 parent 2f41eb0 commit e3a88d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/nx/src/utils/fileutils.ts
Expand Up @@ -130,6 +130,8 @@ export async function extractFileFromTarball(
stream.pipe(destinationFileStream);
stream.on('end', () => {
isFileExtracted = true;
});
destinationFileStream.on('close', () => {
resolve(destinationFilePath);
});
}
Expand Down

0 comments on commit e3a88d4

Please sign in to comment.