Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Commit 39f0124

Browse files
joaocgreisiarna
authored andcommitted
cache: ignore failures replacing package.json
writeFileAtomic is not atomic in Windows, it fails if the file is being accessed concurrently. Fixes: #7885 Fixes: #9696 PR-URL: #10940 Credit: @orangemocha Reviewed-By: @othiym23
1 parent 0cafa7d commit 39f0124

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/cache.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ function afterAdd (cb) {
348348

349349
// Save the resolved, shasum, etc. into the data so that the next
350350
// time we load from this cached data, we have all the same info.
351+
// Ignore if it fails.
351352
var pj = path.join(cachedPackageRoot(data), 'package', 'package.json')
352353

353354
var done = inflight(pj, cb)
@@ -358,7 +359,7 @@ function afterAdd (cb) {
358359
if (er) return done(er)
359360
writeFileAtomic(pj, JSON.stringify(data), { chown: cs }, function (er) {
360361
if (!er) log.verbose('afterAdd', pj, 'written')
361-
return done(er, data)
362+
return done(null, data)
362363
})
363364
})
364365
}

0 commit comments

Comments
 (0)