Skip to content

Commit

Permalink
Merge pull request #4 from oneut/support_command_stderr
Browse files Browse the repository at this point in the history
Support command stderr
  • Loading branch information
oneut committed Mar 25, 2018
2 parents a27f1c0 8c2cd67 commit ef521d4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 74,15 @@ func (c *Command) Start() {
}
}()

stdouterr, _ := c.cmd.StderrPipe()
go func() {
scanner := bufio.NewScanner(stdouterr)
for scanner.Scan() {
line := scanner.Text()
logger.InfoCommandStdout(c.name, c.commandName, line)
}
}()

defer c.Kill()
c.cmd.Start()
c.cmd.Wait()
Expand Down

0 comments on commit ef521d4

Please sign in to comment.