diff --git a/bin/cli.js b/bin/cli.js index aa7df4c2d9c..3819cda71a0 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -326,14 +326,21 @@ For more information, see https://webpack.js.org/api/cli/.`); const SIX_DAYS = 518400000; const now = new Date(); if (now.getDay() === MONDAY) { - const { statSync, utimesSync } = require("fs"); + const { + access, + constants, + statSync, + utimesSync, + } = require("fs"); const lastPrint = statSync(openCollectivePath).atime; const lastPrintTS = new Date(lastPrint).getTime(); const timeSinceLastPrint = now.getTime() - lastPrintTS; if (timeSinceLastPrint > SIX_DAYS) { require(openCollectivePath); // On windows we need to manually update the atime - utimesSync(openCollectivePath, now, now); + access(openCollectivePath, constants.W_OK, (e) => { + if (!e) utimesSync(openCollectivePath, now, now); + }); } } }