Skip to content

Commit

Permalink
fix(sast): race condition remediation
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeriopeixotocx committed May 4, 2021
1 parent 663af0a commit 1131814
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/console/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,12 @@ func printOutput(outputPath, filename string, body interface{}, formats []string
func gracefulShutdown() {
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
showErrors := consoleHelpers.ShowError("errors")
interruptCode := constants.SignalInterruptCode
go func(showErrors bool, interruptCode int) {
<-c
if consoleHelpers.ShowError("errors") {
os.Exit(constants.SignalInterruptCode)
if showErrors {
os.Exit(interruptCode)
}
}()
}(showErrors, interruptCode)
}

0 comments on commit 1131814

Please sign in to comment.