Skip to content

Commit 8fae31c

Browse files
authored
catch and report start cmd failure rather than panicing (#676)
* do not report the process as running if it failed to start * change the return values on error to match what the other platforms produce
1 parent e0851cb commit 8fae31c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

runner/engine.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,13 @@ func (e *Engine) runBin() error {
538538
default:
539539
e.procKillWg.Add(1)
540540
command := strings.Join(append([]string{e.config.Build.Bin}, e.runArgs...), " ")
541-
cmd, stdout, stderr, _ := e.startCmd(command)
541+
cmd, stdout, stderr, err := e.startCmd(command)
542+
if err != nil {
543+
e.mainLog("failed to start %s, error: %s", e.config.rel(e.config.binPath()), err.Error())
544+
close(killCh)
545+
continue
546+
}
547+
542548
processExit := make(chan struct{})
543549
e.mainDebug("running process pid %v", cmd.Process.Pid)
544550
if e.config.Proxy.Enabled {

runner/util_linux.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@ func (e *Engine) killCmd(cmd *exec.Cmd) (pid int, err error) {
3131
func (e *Engine) startCmd(cmd string) (*exec.Cmd, io.ReadCloser, io.ReadCloser, error) {
3232
c := exec.Command("/bin/sh", "-c", cmd)
3333
f, err := pty.Start(c)
34-
return c, f, f, err
34+
if err != nil {
35+
return nil, nil, nil, err
36+
}
37+
return c, f, f, nil
3538
}

0 commit comments

Comments
 (0)