mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 04:04:25 +01:00
29 lines
611 B
Go
29 lines
611 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
|
|
"github.com/rs/zerolog"
|
|
"github.com/rs/zerolog/log"
|
|
"github.com/zricethezav/gitleaks/v8/cmd"
|
|
)
|
|
|
|
func main() {
|
|
// send all logs to stdout
|
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
|
|
|
// 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.Execute()
|
|
}
|
|
|
|
func listenForInterrupt(stopScan chan os.Signal) {
|
|
<-stopScan
|
|
log.Fatal().Msg("Interrupt signal received. Exiting...")
|
|
}
|