diff --git a/file.go b/file.go index d93a6e7..604bd02 100644 --- a/file.go +++ b/file.go @@ -86,12 +86,15 @@ func (f *File) Do(CmdTimeout time.Duration) (string, error) { } f.owner.log.Info("DO: ", f.Cmd) done := make(chan string, 1) + var b bytes.Buffer + cmd.Stdout = &b + cmd.Stderr = &b + err := cmd.Start() + if err != nil { + f.owner.log.Error("cmd start error: ", err) + panic(err) + } go func() { - - var b bytes.Buffer - cmd.Stdout = &b - cmd.Stderr = &b - cmd.Start() f.pid = cmd.Process.Pid cmd.Wait() done <- b.String()