diff --git a/lib/runner.go b/lib/runner.go index b63e98d..756d128 100644 --- a/lib/runner.go +++ b/lib/runner.go @@ -97,24 +97,16 @@ func (r *runner) Exited() bool { func (r *runner) runBin() error { r.command = exec.Command(r.bin, r.args...) - stdout, err := r.command.StdoutPipe() - if err != nil { - return err - } - stderr, err := r.command.StderrPipe() - if err != nil { - return err - } + r.command.Stdout = r.writer // Eascaped ansi color code output + r.command.Stderr = r.writer - err = r.command.Start() + err := r.command.Start() if err != nil { return err } r.starttime = time.Now() - go io.Copy(r.writer, stdout) - go io.Copy(r.writer, stderr) go r.command.Wait() return nil diff --git a/lib/runner_test.go b/lib/runner_test.go index 7a5f57c..d9260e8 100644 --- a/lib/runner_test.go +++ b/lib/runner_test.go @@ -85,7 +85,7 @@ func Test_Runner_SetWriter(t *testing.T) { expect(t, err, nil) if runtime.GOOS == "windows" { - expect(t, buff.String(), "Hello world\r\n") + expect(t, buff.String(), "\\x1B[01;94mHello world\\x1B[0m\r\n") } else { expect(t, buff.String(), "Hello world\n") } diff --git a/lib/test_fixtures/writing_output b/lib/test_fixtures/writing_output index 5a2ad6d..d4a48c7 100755 --- a/lib/test_fixtures/writing_output +++ b/lib/test_fixtures/writing_output @@ -1,3 +1,3 @@ #!/usr/bin/env bash sleep 0.05 -echo "Hello world" +echo -e "\x1B[01;94mHello world\x1B[0m" diff --git a/lib/test_fixtures/writing_output.bat b/lib/test_fixtures/writing_output.bat index 9a1d19d..4b19dca 100644 --- a/lib/test_fixtures/writing_output.bat +++ b/lib/test_fixtures/writing_output.bat @@ -1 +1 @@ -@echo Hello world +@echo \x1B[01;94mHello world\x1B[0m