Merge pull request #244 from cfzlp/non-zero-exit-for-leaks

Return exit code 1 when leaks are found
This commit is contained in:
Zachary Rice authored and GitHub committed 2019-08-01 09:50:24 -05:00
commit 04e81270cb
1 file changed
+7 -1
+7 -1
View File
@@ -9,7 +9,7 @@ import (
)
func main() {
_, err := gitleaks.Run(gitleaks.ParseOpts())
leakCount, err := gitleaks.Run(gitleaks.ParseOpts())
if err != nil {
if strings.Contains(err.Error(), "whitelisted") {
log.Info(err.Error())
@@ -18,4 +18,10 @@ func main() {
log.Error(err)
os.Exit(gitleaks.ErrExit)
}
if leakCount == 0 {
os.Exit(gitleaks.NoLeaks)
} else {
os.Exit(gitleaks.LeakExit)
}
}