From ef4d2fcc7287db74c483691d563658de7dffbb3a Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Thu, 13 Jun 2019 15:18:19 +0200 Subject: [PATCH] Don't use sudo-prompt when already elevated Changelog-entry: Don't use sudo-prompt when already elevated Change-type: patch --- lib/shared/permissions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/shared/permissions.js b/lib/shared/permissions.js index 2e89084f..b051cc7f 100755 --- a/lib/shared/permissions.js +++ b/lib/shared/permissions.js @@ -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 }) => {