Skip to content

Commit

Permalink
Merge pull request #13 from juergenhoetzel/stderr
Browse files Browse the repository at this point in the history
Pass Stderr of hook command to os.Stderr
  • Loading branch information
justincampbell authored Feb 8, 2021
2 parents ff7ed3f + 9e74432 commit 93f7cbe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hook/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ func Run(client *openpomodoro.Client, name string) error {
}

cmd := exec.Command(filename)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Env = os.Environ()
if output, err := cmd.Output(); err != nil {
fmt.Printf("Hook %q failed:\n%s\n\n", name, output)
if err := cmd.Run(); err != nil {
fmt.Fprintf(os.Stderr, "Hook %q failed:\n\n", name)
return err
}

Expand Down

0 comments on commit 93f7cbe

Please sign in to comment.