6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-04 16:49:43 +00:00

Fix showing stdout of git commands

We need to capture also stderr because this is where eg, the progress of git clone is printed
This commit is contained in:
Grzegorz Dlugoszewski
2020-06-30 13:54:43 +02:00
parent fe35a7e493
commit d0797ad9b7

View File

@@ -76,16 +76,14 @@ func (c *Cmd) AndCaptureLine() (string, error) {
return lines[0], nil
}
// AndShow executes the command and prints its output into standard output.
// AndShow executes the command and prints its stderr and stdout.
func (c *Cmd) AndShow() error {
c.cmd.Stdout = os.Stdout
errStream := &bytes.Buffer{}
c.cmd.Stderr = errStream
c.cmd.Stderr = os.Stderr
err := c.cmd.Run()
if err != nil {
return &GitError{errStream, c.cmd.Args, err}
return &GitError{&bytes.Buffer{}, c.cmd.Args, err}
}
return nil
}