From c3b5a768e1d5fd4e905773d8269aaeb364ae791f Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Thu, 12 Nov 2015 13:30:48 -0400 Subject: [PATCH] Handle Windows permissions elevation automatically --- build/utils/helpers.js | 7 +++---- lib/utils/helpers.coffee | 10 +++------- package.json | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/build/utils/helpers.js b/build/utils/helpers.js index df2dc4e9..f4714adb 100644 --- a/build/utils/helpers.js +++ b/build/utils/helpers.js @@ -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); }; diff --git a/lib/utils/helpers.coffee b/lib/utils/helpers.coffee index b8ee980d..6496a192 100644 --- a/lib/utils/helpers.coffee +++ b/lib/utils/helpers.coffee @@ -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) diff --git a/package.json b/package.json index 1f5d682a..6e39c57d 100644 --- a/package.json +++ b/package.json @@ -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",