Handle Windows permissions elevation automatically

This commit is contained in:
Juan Cruz Viotti 2015-11-12 13:30:48 -04:00
parent 111ea44b40
commit c3b5a768e1
3 changed files with 7 additions and 12 deletions

View File

@ -38,11 +38,10 @@
};
exports.sudo = function(command) {
if (os.platform() === 'win32') {
return capitano.runAsync(command.join(' '));
}
command = _.union(_.take(process.argv, 2), command);
console.log('Type your computer password to continue');
if (os.platform() !== 'win32') {
console.log('Type your computer password to continue');
}
return president.executeAsync(command);
};

View File

@ -29,13 +29,9 @@ exports.stateToString = (state) ->
throw new Error("Unsupported operation: #{state.operation.type}")
exports.sudo = (command) ->
# Bypass privilege elevation for Windows for now.
# We should use `windosu` in this case.
if os.platform() is 'win32'
return capitano.runAsync(command.join(' '))
command = _.union(_.take(process.argv, 2), command)
console.log('Type your computer password to continue')
if os.platform() isnt 'win32'
console.log('Type your computer password to continue')
return president.executeAsync(command)

View File

@ -46,7 +46,7 @@
"is-root": "^1.0.0",
"lodash": "^3.10.0",
"nplugm": "^3.0.0",
"president": "^2.0.0",
"president": "^2.0.1",
"prettyjson": "^1.1.3",
"resin-cli-errors": "^1.0.0",
"resin-cli-events": "^1.0.2",