mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-23 23:42:24 +00:00
5de0f66d7a
`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.
17 lines
477 B
CoffeeScript
17 lines
477 B
CoffeeScript
updateNotifier = require('update-notifier')
|
|
isRoot = require('is-root')
|
|
packageJSON = require('../../package.json')
|
|
|
|
# `update-notifier` creates files to make the next
|
|
# running time ask for updated, however this can lead
|
|
# to ugly EPERM issues if those files are created as root.
|
|
if not isRoot()
|
|
notifier = updateNotifier(pkg: packageJSON)
|
|
|
|
exports.hasAvailableUpdate = ->
|
|
return notifier?
|
|
|
|
exports.notify = ->
|
|
return if not exports.hasAvailableUpdate()
|
|
notifier.notify()
|