From 6e3c000576d6256be7d48ec39a239c2673a5dea2 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Fri, 13 Nov 2015 13:35:09 -0400 Subject: [PATCH] Fire and forget OS X sudo prompt Currently, the parent application will not be closed until the children process is closed, leading to two Herostratus applications running at the same time on OS X. --- lib/elevate.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/elevate.js b/lib/elevate.js index 65a8a3f0..6ec8b3ee 100644 --- a/lib/elevate.js +++ b/lib/elevate.js @@ -45,15 +45,10 @@ exports.require = function(callback) { if (platform === 'darwin') { sudoPrompt.setName('Herostratus'); - sudoPrompt.exec(process.argv.join(' '), function(error) { - if (error) { - console.error(error.message); - process.exit(1); - } - - // Don't keep the original parent process alive + sudoPrompt.exec(process.argv.join(' ')); + setTimeout(function() { process.exit(0); - }); + }, 300); } else if (platform === 'win32') { var command = _.map(process.argv, function(word) {