Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Commit

Permalink
remove exec command from executor
Browse files Browse the repository at this point in the history
exec was added to replace bash process upon execution, but it doesn't support basic bash operators such as and and or.
  • Loading branch information
farshidtz committed Feb 22, 2020
1 parent 2eef720 commit 03d208b
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions agent/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"log"
"os"
"os/exec"
"strings"
"sync"
"syscall"

Expand Down Expand Up @@ -50,13 +49,7 @@ func newExecutor(task, stage string, logEnqueue enqueueFunc, debug bool) *execut
func (e *executor) execute(command string) (success bool) {
e.sendLog(command, model.ExecStart, false)

// Use exec to replace the shell process, rather than making a subprocess.
// This is necessary to propagate interrupt signal to certain programs.
if !strings.HasPrefix(strings.TrimSpace(command), "exec") {
e.cmd = exec.Command("/bin/sh", "-c", "exec "+command)
} else {
e.cmd = exec.Command("/bin/sh", "-c", command)
}
e.cmd = exec.Command("/bin/sh", "-c", command)

defer func() { e.cmd = nil }()

Expand Down

0 comments on commit 03d208b

Please sign in to comment.