mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
Merge pull request #244 from cfzlp/non-zero-exit-for-leaks
Return exit code 1 when leaks are found
This commit is contained in:
1 file changed
+7
-1
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user