Skip to content

Commit

Permalink
Update lib/internal/fs/copy/copy.js
Browse files Browse the repository at this point in the history
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
bcoe and aduh95 committed Jul 15, 2021
1 parent 9582d0f commit 84a0328
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions lib/internal/fs/copy/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,7 @@ async function setDestTimestamps(src, dest) {
// because it is modified by the read(2) system call
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
const updatedSrcStat = await stat(src);
return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
}

async function utimesMillis(path, atime, mtime) {
const fd = await open(path, 'r+');
try {
await fd.utimes(atime, mtime);
} finally {
await fd.close();
}
return utimes(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
}

function onDir(srcStat, destStat, src, dest, opts) {
Expand Down

0 comments on commit 84a0328

Please sign in to comment.