diff options
author | KatolaZ <katolaz@freaknet.org> | 2017-08-07 16:22:14 +0100 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2017-08-07 16:22:14 +0100 |
commit | 9d60b3d95d49c1097ceeb641f857fe724c4d9cab (patch) | |
tree | 15442dc35e0a60b0210347c2943465f96315fd97 /exec.go | |
parent | 200e2f0328b6cfc6965d5399d7750df19eec6144 (diff) |
fixed -- correct execution order of scorsh commands
Diffstat (limited to 'exec.go')
-rw-r--r-- | exec.go | 22 |
1 files changed, 3 insertions, 19 deletions
@@ -7,7 +7,6 @@ import ( "io/ioutil" "log" "net/url" - "os" "os/exec" ) @@ -55,7 +54,7 @@ func execURL(cmdURL *url.URL, args, env []string) error { return nil } -func execCommand(cmd *commandCfg, args []string, env []string) []error { +func (cmd *command) exec() []error { var ret []error @@ -78,29 +77,14 @@ func execCommand(cmd *commandCfg, args []string, env []string) []error { continue } else { // finally, the command can be executed - err = execLocalFile(actionURL, args, env) + err = execLocalFile(actionURL, cmd.Args, cmd.Env) } } else if actionURL.Scheme == "http" || actionURL.Scheme == "https" { - err = execURL(actionURL, args, env) + err = execURL(actionURL, cmd.Args, cmd.Env) } } ret = append(ret, err) } return ret } - -func setEnvironment(msg *spoolMsg, cmd, author, committer string) []string { - - env := os.Environ() - env = append(env, fmt.Sprintf("SCORSH_REPO=%s", msg.Repo)) - env = append(env, fmt.Sprintf("SCORSH_BRANCH=%s", msg.Branch)) - env = append(env, fmt.Sprintf("SCORSH_OLDREV=%s", msg.OldRev)) - env = append(env, fmt.Sprintf("SCORSH_NEWREV=%s", msg.NewRev)) - env = append(env, fmt.Sprintf("SCORSH_ID=%s", msg.ID)) - env = append(env, fmt.Sprintf("SCORSH_COMMAND=%s", cmd)) - env = append(env, fmt.Sprintf("SCORSH_AUTHOR=%s", author)) - env = append(env, fmt.Sprintf("SCORSH_COMMITTER=%s", committer)) - - return env -} |