From 7bf46cb40b1a9fe5a30b0e725426d799a7d10e80 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Wed, 10 Oct 2012 12:24:36 -0700 Subject: [PATCH] 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 --- common.jake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common.jake b/common.jake index 720f7d923..9eded1280 100644 --- a/common.jake +++ b/common.jake @@ -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; };