Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Update exit codes from 0 to 1 on Fatal messages. Add exit codes where…
Browse files Browse the repository at this point in the history
… they were missing
  • Loading branch information
geauxvirtual committed Oct 21, 2015
1 parent 62e714d commit b7d36d8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pulse.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func action(ctx *cli.Context) {
"error": err.Error(),
"logpath": logPath,
}).Fatal("bad log path (must be a dir)")
os.Exit(0)
os.Exit(1)
}
if !f.IsDir() {
log.WithFields(
Expand All @@ -245,7 +245,7 @@ func action(ctx *cli.Context) {
"_module": "pulsed",
"logpath": logPath,
}).Fatal("bad log path (this is not a directory)")
os.Exit(0)
os.Exit(1)
}

file, err2 := os.OpenFile(fmt.Sprintf("%s/pulse.log", logPath), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
Expand All @@ -257,6 +257,7 @@ func action(ctx *cli.Context) {
"error": err2.Error(),
"logpath": logPath,
}).Fatal("bad log path")
os.Exit(1)
}
defer file.Close()
log.Info("setting log path to: ", logPath)
Expand All @@ -278,6 +279,7 @@ func action(ctx *cli.Context) {
"error": err.Error(),
"path": config,
}).Fatal("unable to read config")
os.Exit(1)
}
cfg := control.NewConfig()
err = json.Unmarshal(b, &cfg)
Expand Down Expand Up @@ -354,7 +356,7 @@ func action(ctx *cli.Context) {
"_module": "pulsed",
"keyringFile": keyringFile,
}).Fatal("need keyring file when trust is on (--keyring-file or -k)")
os.Exit(0)
os.Exit(1)
}
f, err := os.Stat(keyringFile)
if err != nil {
Expand All @@ -365,7 +367,7 @@ func action(ctx *cli.Context) {
"error": err.Error(),
"keyringFile": keyringFile,
}).Fatal("bad keyring file")
os.Exit(0)
os.Exit(1)
}
if f.IsDir() {
log.WithFields(
Expand All @@ -374,7 +376,7 @@ func action(ctx *cli.Context) {
"_module": "pulsed",
"logpath": keyringFile,
}).Fatal("bad keyring file (this is not a file)")
os.Exit(0)
os.Exit(1)
}
file, err := os.Open(keyringFile)
if err != nil {
Expand All @@ -385,7 +387,7 @@ func action(ctx *cli.Context) {
"error": err.Error(),
"keyringFile": keyringFile,
}).Fatal("can't open keyring path")
os.Exit(0)
os.Exit(1)
defer file.Close()
}
log.Info("setting keyring file to: ", keyringFile)
Expand All @@ -407,7 +409,7 @@ func action(ctx *cli.Context) {
"_module": "pulsed",
"autodiscoverpath": path,
}).Fatal(err)
os.Exit(0)
os.Exit(1)
}
for _, file := range files {
if file.IsDir() {
Expand Down

0 comments on commit b7d36d8

Please sign in to comment.