Skip to content

Commit

Permalink
Fix tests on Node.js 14 and later (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Apr 7, 2022
1 parent 778ecdb commit 5dbf6dc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Expand Up @@ -21,7 +21,10 @@ const cpFileAsync = async (source, destination, options, progressEmitter) => {

readStream.once('error', error => {
readError = new CpFileError(`Cannot read from \`${source}\`: ${error.message}`, error);
writeStream.end();
const nodeMajorVersion = parseInt(process.versions.node.slice(0, 2), 10);
if (nodeMajorVersion < 14) {
writeStream.end();
}
});

let shouldUpdateStats = false;
Expand Down

0 comments on commit 5dbf6dc

Please sign in to comment.