fix: Merge stdout and stderr.

This commit is contained in:
Nicolas Carlier 2014-11-06 16:03:59 +00:00
parent 79def293f0
commit 539b674cc7

View File

@ -21,7 +21,7 @@ func RunScript(work *WorkRequest) (string, error) {
}
scriptname := path.Join(scriptsdir, work.Name, fmt.Sprintf("%s.sh", work.Action))
fmt.Println("Exec script: ", scriptname)
fmt.Println("Exec script: ", scriptname, "...")
// Exec script...
cmd := exec.Command(scriptname, work.Args...)
@ -35,16 +35,19 @@ func RunScript(work *WorkRequest) (string, error) {
defer outfile.Close()
cmd.Stdout = outfile
cmd.Stderr = outfile
err = cmd.Start()
if err != nil {
return "", err
return outfilename, err
}
err = cmd.Wait()
if err != nil {
return "", err
fmt.Println("Exec script: ", scriptname, "KO!")
return outfilename, err
}
fmt.Println("Exec script: ", scriptname, "OK")
return outfilename, nil
}