diff options
Diffstat (limited to 'internal/pkg/exec.go')
| -rw-r--r-- | internal/pkg/exec.go | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/internal/pkg/exec.go b/internal/pkg/exec.go index bc068d1e..e06ec32e 100644 --- a/internal/pkg/exec.go +++ b/internal/pkg/exec.go @@ -418,6 +418,12 @@ func (a *execArtifact) cure(f *FContext, hostNet bool) (err error) { z.Hostname = "cure-net" } z.Uid, z.Gid = (1<<10)-1, (1<<10)-1 + + var status io.Writer + if status, err = f.GetStatusWriter(); err != nil { + return + } + if msg := f.GetMessage(); msg.IsVerbose() { var stdout, stderr io.ReadCloser if stdout, err = z.StdoutPipe(); err != nil { @@ -434,10 +440,29 @@ func (a *execArtifact) cure(f *FContext, hostNet bool) (err error) { } }() + bw := f.cache.getWriter(status) + defer func() { + flushErr := bw.Flush() + if err == nil { + err = flushErr + } + f.cache.putWriter(bw) + }() + stdoutDone, stderrDone := make(chan struct{}), make(chan struct{}) - go scanVerbose(msg, cancel, stdoutDone, "("+a.name+":1)", stdout) - go scanVerbose(msg, cancel, stderrDone, "("+a.name+":2)", stderr) + go scanVerbose( + msg, cancel, stdoutDone, + "("+a.name+":1)", + io.TeeReader(stdout, bw), + ) + go scanVerbose( + msg, cancel, stderrDone, + "("+a.name+":2)", + io.TeeReader(stderr, bw), + ) defer func() { <-stdoutDone; <-stderrDone }() + } else { + z.Stdout, z.Stderr = status, status } z.Dir, z.Env, z.Path, z.Args = a.dir, a.env, a.path, a.args |
