mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13: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() {
|
func main() {
|
||||||
_, err := gitleaks.Run(gitleaks.ParseOpts())
|
leakCount, err := gitleaks.Run(gitleaks.ParseOpts())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), "whitelisted") {
|
if strings.Contains(err.Error(), "whitelisted") {
|
||||||
log.Info(err.Error())
|
log.Info(err.Error())
|
||||||
@@ -18,4 +18,10 @@ func main() {
|
|||||||
log.Error(err)
|
log.Error(err)
|
||||||
os.Exit(gitleaks.ErrExit)
|
os.Exit(gitleaks.ErrExit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if leakCount == 0 {
|
||||||
|
os.Exit(gitleaks.NoLeaks)
|
||||||
|
} else {
|
||||||
|
os.Exit(gitleaks.LeakExit)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user