Don't use sudo-prompt when already elevated

Changelog-entry: Don't use sudo-prompt when already elevated
Change-type: patch
This commit is contained in:
Alexis Svinartchouk 2019-06-13 15:18:19 +02:00
parent 330c06d926
commit ef4d2fcc72

View File

@ -179,6 +179,10 @@ const elevateScriptUnix = async (path, name) => {
* });
*/
exports.elevateCommand = async (command, options) => {
if (await exports.isElevated()) {
await childProcess.execFileAsync(command[0], command.slice(1), { env: options.environment })
return { cancelled: false }
}
const isWindows = os.platform() === 'win32'
const launchScript = exports.createLaunchScript(command[0], command.slice(1), options.environment)
return Bluebird.using(tmpFileDisposer({ postfix: '.cmd' }), async ({ path }) => {