summaryrefslogtreecommitdiff
path: root/exec.go
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2017-08-07 16:22:14 +0100
committerKatolaZ <katolaz@freaknet.org>2017-08-07 16:22:14 +0100
commit9d60b3d95d49c1097ceeb641f857fe724c4d9cab (patch)
tree15442dc35e0a60b0210347c2943465f96315fd97 /exec.go
parent200e2f0328b6cfc6965d5399d7750df19eec6144 (diff)
fixed -- correct execution order of scorsh commands
Diffstat (limited to 'exec.go')
-rw-r--r--exec.go22
1 files changed, 3 insertions, 19 deletions
diff --git a/exec.go b/exec.go
index be52bd6..857cd72 100644
--- a/exec.go
+++ b/exec.go
@@ -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
-}