Skip to content

Commit

Permalink
Use updatedSrcStat for both atime and mtime (review)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbargiel committed Feb 3, 2020
1 parent 09309b0 commit 75756c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/copy-sync/copy-sync.js
Expand Up @@ -104,7 +104,7 @@ function setDestTimestampsAndMode (srcStat, src, dest, opts) {
// The initial srcStat.atime cannot be trusted because it is modified by the read(2) system call
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
const updatedSrcStat = fs.statSync(src)
utimesSync(dest, updatedSrcStat.atime, srcStat.mtime)
utimesSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
}
chmodSync(dest, srcStat.mode)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/copy/copy.js
Expand Up @@ -127,7 +127,7 @@ function setDestTimestampsAndMode (srcStat, src, dest, opts, cb) {
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
return fs.stat(src, (err, updatedSrcStat) => {
if (err) return cb(err)
return utimesMillis(dest, updatedSrcStat.atime, srcStat.mtime, (err2) => {
return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, (err2) => {
if (err2) return cb(err2)
return fs.chmod(dest, srcStat.mode, cb)
})
Expand Down

0 comments on commit 75756c4

Please sign in to comment.