From 7035283011cf3bd7deec82a61475c9e8edb5491d Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Sun, 4 May 2014 12:28:31 +0100 Subject: Make gitano-command cgi use runcmd --- bin/gitano-command.cgi.in | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/bin/gitano-command.cgi.in b/bin/gitano-command.cgi.in index 681603b..2fa1db2 100755 --- a/bin/gitano-command.cgi.in +++ b/bin/gitano-command.cgi.in @@ -29,26 +29,6 @@ function url_decode(str) return str end -function run_command(cmd, cmdline, parsed_cmdline, user, config, env, repo) - gitano.log.debug("Welcome to " .. config.global.site_name) - gitano.log.debug("Running:") - for i = 1, #parsed_cmdline do - gitano.log.debug(" => " .. parsed_cmdline[i]) - end - gitano.log.debug("") - gitano.log.debug("On behalf of " .. user .. " using key " .. env["GITANO_KEYTAG"]) - - local how, why = cmd.run(config, repo, parsed_cmdline, env) - - if how ~= "exit" or why ~= 0 then - gitano.log.critical("Error running " .. parsed_cmdline[1] .. ": " .. how) - return why - else - gitano.log.syslog.info(cmdline, "completed successfully") - return 0 - end -end - if os.getenv("QUERY_STRING") then local query_string = url_decode(os.getenv("QUERY_STRING")) local cmdline = query_string @@ -77,7 +57,7 @@ if os.getenv("QUERY_STRING") then gitano.auth.is_authorized(user, "http", cmdline, os.getenv("GITANO_ROOT")) if authorized then - local exit = run_command(cmd, cmdline, parsed_cmdline, + local exit = gitano.util.run_command(cmd, cmdline, parsed_cmdline, user, config, env, repo) stdout:write("Status: " .. (exit == 0 and "200 OK" or "400 Bad request") -- cgit v1.2.1