balena-cli/build/utils/update.js
Juan Cruz Viotti 5de0f66d7a Don't check for available updates when running as root
`update-notifier` persist its update check results in a file, which is
then read when running again the application.

If this file gets written when the application is being run as root, we
get ugly EPERM issues.
2015-08-20 16:54:22 -04:00

28 lines
506 B
JavaScript

(function() {
var isRoot, notifier, packageJSON, updateNotifier;
updateNotifier = require('update-notifier');
isRoot = require('is-root');
packageJSON = require('../../package.json');
if (!isRoot()) {
notifier = updateNotifier({
pkg: packageJSON
});
}
exports.hasAvailableUpdate = function() {
return notifier != null;
};
exports.notify = function() {
if (!exports.hasAvailableUpdate()) {
return;
}
return notifier.notify();
};
}).call(this);