Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions bin/commands/runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,23 @@ module.exports = function run(args, rawArgs) {
utils.sendUsageReport(bsJsonData, args, err.message, Constants.messageTypes.ERROR, utils.getErrorCodeFromErr(err), null, rawArgs);
process.exitCode = Constants.ERROR_EXIT_CODE;
}).finally(function(){
updateNotifier({
const notifier = updateNotifier({
pkg,
updateCheckInterval: 1000 * 60 * 60 * 24 * 7,
}).notify({isGlobal: true});
});

// Checks for update on first run.
// Set lastUpdateCheck to 0 to spawn the check update process as notifier sets this to Date.now() for preventing
// the check untill one interval period. It runs once.
if (!notifier.disabled && Date.now() - notifier.config.get('lastUpdateCheck') < 50) {
notifier.config.set('lastUpdateCheck', 0);
notifier.check();
}

// Set the config update as notifier clears this after reading.
if (notifier.update && notifier.update.current !== notifier.update.latest) {
notifier.config.set('update', notifier.update);
notifier.notify({isGlobal: true});
}
});
}