Skip to content

Commit

Permalink
Attach stdout/stderr in RunAndWait (#209)
Browse files Browse the repository at this point in the history
For #207. We need to
attach stdout/stderr for a command whenever we don't have logging fields
set so that we capture the output of our main application. But we can't
do this in `setUpCmd` because it breaks the case of `RunAndWaitForOutput`
so we've added it to `RunAndWait` directly.
  • Loading branch information
tgross authored Aug 15, 2016
1 parent 8d4f123 commit 574570a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func RunAndWait(c *Command, fields log.Fields) (int, error) {
}
log.Debugf("%s.RunAndWait start", c.Name)
c.setUpCmd(fields)
if fields == nil {
c.Cmd.Stdout = os.Stdout
c.Cmd.Stderr = os.Stderr
}
log.Debugf("%s.Cmd.Run", c.Name)
if err := c.Cmd.Run(); err != nil {
if exiterr, ok := err.(*exec.ExitError); ok {
Expand Down

0 comments on commit 574570a

Please sign in to comment.