Add support for disabling sudo action

you can set CAPP_NOSUDO=1 in your environment to disable any sudo action.
This means that if a command failed as current user, jake
will not try to run it with sudo,and will simply return the error code
This commit is contained in:
Antoine Mercadal
2012-10-10 12:24:36 -07:00
parent 385de88e2f
commit 7bf46cb40b
+11 -1
View File
@@ -466,8 +466,18 @@ global.sudo = function(/*Array or String*/ command)
// First try without sudo
command = normalizeCommand(command);
if (OS.system(command + " >/dev/null 2>&1"))
var returnCode = OS.system(command + " >/dev/null 2>&1")
if (returnCode)
{
// if this is set, then disable the use of sudo.
// This is very usefull for CI scripts and stuff like that
if (SYSTEM.env["CAPP_NOSUDO"] == 1)
return returnCode;
return OS.system("sudo -p '\nEnter your admin password: ' " + command);
}
return 0;
};