Skip to content

Commit 5dbf6dc

Browse files
authoredApr 7, 2022
Fix tests on Node.js 14 and later (#48)
1 parent 778ecdb commit 5dbf6dc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ const cpFileAsync = async (source, destination, options, progressEmitter) => {
2121

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

2730
let shouldUpdateStats = false;

0 commit comments

Comments
 (0)
Please sign in to comment.