mirror of
https://github.com/Luzifer/cmd-slack.git
synced 2024-12-22 18:51:18 +00:00
Do not send message when output is empty
This commit is contained in:
parent
f7e94e4975
commit
faea9b1bd5
1 changed files with 7 additions and 0 deletions
7
main.go
7
main.go
|
@ -5,7 +5,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/Luzifer/rconfig"
|
"github.com/Luzifer/rconfig"
|
||||||
)
|
)
|
||||||
|
@ -39,6 +41,11 @@ func main() {
|
||||||
log.Fatalf("Command error: %s", err)
|
log.Fatalf("Command error: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.TrimSpace(buf.String()) == "" {
|
||||||
|
log.Printf("Command had empty output, ignoring")
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
slo := slack{
|
slo := slack{
|
||||||
Username: cfg.Username,
|
Username: cfg.Username,
|
||||||
Icon: cfg.Icon,
|
Icon: cfg.Icon,
|
||||||
|
|
Loading…
Reference in a new issue