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.
This commit is contained in:
Juan Cruz Viotti 2015-11-13 13:35:09 -04:00
parent a0417cdda0
commit 6e3c000576

View File

@ -45,15 +45,10 @@ exports.require = function(callback) {
if (platform === 'darwin') { if (platform === 'darwin') {
sudoPrompt.setName('Herostratus'); sudoPrompt.setName('Herostratus');
sudoPrompt.exec(process.argv.join(' '), function(error) { sudoPrompt.exec(process.argv.join(' '));
if (error) { setTimeout(function() {
console.error(error.message);
process.exit(1);
}
// Don't keep the original parent process alive
process.exit(0); process.exit(0);
}); }, 300);
} }
else if (platform === 'win32') { else if (platform === 'win32') {
var command = _.map(process.argv, function(word) { var command = _.map(process.argv, function(word) {