Fix issue where docker output was lost.

This commit is contained in:
Péter Szilágyi 2014-10-22 13:33:00 +03:00
parent 8b07996b81
commit 8608efa0e5

14
xgo.go
View File

@ -10,7 +10,6 @@ import (
"bytes"
"flag"
"fmt"
"io"
"log"
"os"
"os/exec"
@ -102,15 +101,8 @@ func compile(path string, prefix string, verbose bool, race bool) error {
// Executes a command synchronously, redirecting its output to stdout.
func run(cmd *exec.Cmd) error {
if out, err := cmd.StdoutPipe(); err != nil {
return err
} else {
go io.Copy(os.Stdout, out)
}
if out, err := cmd.StderrPipe(); err != nil {
return err
} else {
go io.Copy(os.Stderr, out)
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}