Skip to content

Commit

Permalink
Exit code update, introduce leaks-exit-code flag (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
zricethezav committed Dec 8, 2020
1 parent 65f4202 commit 3909ebe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func main() {
log.Error(err)
os.Exit(1)
}

if len(scannerReport.Leaks) != 0 {
os.Exit(opts.CodeOnLeak)
}
}

func listenForInterrupt(stopScan chan os.Signal) {
Expand Down
1 change: 1 addition & 0 deletions options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Options struct {
Redact bool `long:"redact" description:"Redact secrets from log messages and leaks"`
Debug bool `long:"debug" description:"Log debug messages"`
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 string `short:"o" long:"report" description:"Report output path"`
Expand Down

0 comments on commit 3909ebe

Please sign in to comment.