Allow to bypass elevation with an environment variable (#343)

This is mostly used for debugging purposes, or by power users that know
what they're doing.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This commit is contained in:
Juan Cruz Viotti 2016-04-19 11:07:59 -04:00
parent fdf28cdf5f
commit 975c949fdf

View File

@ -29,6 +29,12 @@ exports.require = function(app, applicationName, callback) {
}
return Bluebird.try(function() {
// This environment variable is usually set
// for debugging purposes, or for power users
// that really know what they're doing.
if (!process.env.ETCHER_BYPASS_ELEVATION) {
if (platform === 'darwin') {
// Keep parent process hidden
@ -43,6 +49,7 @@ exports.require = function(app, applicationName, callback) {
const elevator = Bluebird.promisifyAll(require('elevator'));
return elevator.executeAsync(process.argv, {});
}
}
throw new Error('Please run this application as root or administrator');
}).then(function() {