1
0
Fork 0
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:
Knut Ahlers 2016-05-22 20:19:50 +02:00
parent f7e94e4975
commit faea9b1bd5
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -5,7 +5,9 @@ import (
"encoding/json"
"log"
"net/http"
"os"
"os/exec"
"strings"
"github.com/Luzifer/rconfig"
)
@ -39,6 +41,11 @@ func main() {
log.Fatalf("Command error: %s", err)
}
if strings.TrimSpace(buf.String()) == "" {
log.Printf("Command had empty output, ignoring")
os.Exit(0)
}
slo := slack{
Username: cfg.Username,
Icon: cfg.Icon,