notify_darwin.go 578 B

123456789101112131415161718192021222324252627
  1. package main
  2. import (
  3. "os/exec"
  4. "gopkg.in/errgo.v1"
  5. )
  6. // uses https://github.com/alloy/terminal-notifier
  7. func notify(passed bool, output string) error {
  8. subTitle := "🚨test failed🚨"
  9. if passed {
  10. subTitle = "🌟test passed🌟"
  11. }
  12. xmsg := exec.Command("open", "-a", "terminal-notifier.app", "--args",
  13. "-title", "testNshowErr",
  14. "-subtitle", subTitle, "-message", output)
  15. out, err := xmsg.CombinedOutput()
  16. if err != nil {
  17. return errgo.Notef(err, "terminal-notifier.app failed: output: %s", out)
  18. }
  19. log.Debugln("terminal-notifier.app:", out)
  20. return nil
  21. }