mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 21:24:21 +01:00
Exit code update, introduce leaks-exit-code flag (#481)
This commit is contained in:
1 parent
65f42020af
commit
3909ebe03b
2 files changed
+5
No files matched your search
@@ -61,6 +61,10 @@ func main() {
|
|||||||
log.Error(err)
|
log.Error(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(scannerReport.Leaks) != 0 {
|
||||||
|
os.Exit(opts.CodeOnLeak)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func listenForInterrupt(stopScan chan os.Signal) {
|
func listenForInterrupt(stopScan chan os.Signal) {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ type Options struct {
|
|||||||
Redact bool `long:"redact" description:"Redact secrets from log messages and leaks"`
|
Redact bool `long:"redact" description:"Redact secrets from log messages and leaks"`
|
||||||
Debug bool `long:"debug" description:"Log debug messages"`
|
Debug bool `long:"debug" description:"Log debug messages"`
|
||||||
NoGit bool `long:"no-git" description:"Treat git repos as plain directories and scan those files"`
|
NoGit bool `long:"no-git" description:"Treat git repos as plain directories and scan those files"`
|
||||||
|
CodeOnLeak int `long:"leaks-exit-code" default:"1" description:"Exit code when leaks have been encountered"`
|
||||||
|
|
||||||
// Report Options
|
// Report Options
|
||||||
Report string `short:"o" long:"report" description:"Report output path"`
|
Report string `short:"o" long:"report" description:"Report output path"`
|
||||||
|
|||||||
Reference in new issue
Block a user