-
Notifications
You must be signed in to change notification settings - Fork 18
/
main.go
29 lines (23 loc) · 695 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"os"
"os/signal"
"github.com/checkmarx/2ms/cmd"
"github.com/checkmarx/2ms/lib/utils"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
func main() {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
log.Logger = utils.CreateLogger(zerolog.InfoLevel)
// this block sets up a go routine to listen for an interrupt signal
// which will immediately exit gitleaks
stopChan := make(chan os.Signal, 1)
signal.Notify(stopChan, os.Interrupt)
go listenForInterrupt(stopChan)
cmd.Exit(cmd.Execute())
}
func listenForInterrupt(stopScan chan os.Signal) {
<-stopScan
log.Fatal().Msg("Interrupt signal received. Exiting...") // lint:ignore We want to exit immediately
}