mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-23 15:32:22 +00:00
a6dc155028
Depedency was missing and thus elevating functions threw errors.
26 lines
472 B
JavaScript
26 lines
472 B
JavaScript
(function() {
|
|
var _, isWindows, os, path;
|
|
|
|
_ = require('lodash');
|
|
|
|
os = require('os');
|
|
|
|
path = require('path');
|
|
|
|
isWindows = function() {
|
|
return os.platform() === 'win32';
|
|
};
|
|
|
|
exports.shouldElevate = function(error) {
|
|
return _.all([isWindows(), error.code === 'EPERM' || error.code === 'EACCES']);
|
|
};
|
|
|
|
exports.run = function(command) {
|
|
if (!isWindows()) {
|
|
return;
|
|
}
|
|
return require('windosu').exec(command);
|
|
};
|
|
|
|
}).call(this);
|