Open
Description
Given a file named "changed.txt" with the contents:
changed-v1
And with the following code added to the copyFile
function:
fromFile.on('error', onError);
toFile.on('error', onError);
fromFile.once('end', function() {
cb(err);
if (to === 'changed.txt') {
console.error(to);
console.error(fs.readFileSync(from, 'utf8'));
console.error(fs.readFileSync(to, 'utf8'));
}
});
fromFile.pipe(toFile);
About 50% of the time I get in the console:
changed.txt
changed-v1
changed-v1
And the other 50% I get:
changed.txt
changed-v1
It seems like there may be a race condition in the piping and "end" event. I should also note that there are other files in the operation, and this is the only one affected. For instance using fixturify:
{ 'changed.txt': '',
'missing-changed.txt': 'changed-v1\n',
'missing-unchanged.txt': 'unchanged\n',
'removed-changed.txt': 'changed-v1\n',
'removed-unchanged.txt': 'unchanged\n',
'unchanged.txt': 'unchanged\n' }
Metadata
Metadata
Assignees
Labels
No labels