diff options
author | Richard Ipsum <richardipsum@fastmail.co.uk> | 2014-05-04 12:28:31 +0100 |
---|---|---|
committer | Richard Ipsum <richardipsum@fastmail.co.uk> | 2014-05-04 12:45:00 +0100 |
commit | 7035283011cf3bd7deec82a61475c9e8edb5491d (patch) | |
tree | caee6f6eebfbc305ffe9b90043e150941f2d301d /bin/gitano-command.cgi.in | |
parent | 635d753a0c86e1213682ffa7cc5ee414c7c9f383 (diff) | |
download | gitano-7035283011cf3bd7deec82a61475c9e8edb5491d.tar.gz |
Make gitano-command cgi use runcmd
Diffstat (limited to 'bin/gitano-command.cgi.in')
-rwxr-xr-x | bin/gitano-command.cgi.in | 22 |
1 files changed, 1 insertions, 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") |