Skip to content

Commit

Permalink
Log command output on error
Browse files Browse the repository at this point in the history
We want to see the command output whether the command exited in error or
not. Otherwise it's very difficult to debug why your command is failing.
  • Loading branch information
philk committed May 13, 2015
1 parent fed32fe commit 23c071e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions resource/template/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ func (t *TemplateResource) check() error {
c := exec.Command("/bin/sh", "-c", cmdBuffer.String())
output, err := c.CombinedOutput()
if err != nil {
log.Error(fmt.Sprintf("%q", string(output)))
return err
}
log.Debug(fmt.Sprintf("%q", string(output)))
Expand All @@ -224,6 +225,7 @@ func (t *TemplateResource) reload() error {
c := exec.Command("/bin/sh", "-c", t.ReloadCmd)
output, err := c.CombinedOutput()
if err != nil {
log.Error(fmt.Sprintf("%q", string(output)))
return err
}
log.Debug(fmt.Sprintf("%q", string(output)))
Expand Down

0 comments on commit 23c071e

Please sign in to comment.