mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
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:
+11
-1
@@ -466,8 +466,18 @@ global.sudo = function(/*Array or String*/ command)
|
|||||||
// First try without sudo
|
// First try without sudo
|
||||||
command = normalizeCommand(command);
|
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 OS.system("sudo -p '\nEnter your admin password: ' " + command);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user