in ibazel/ibazel.go [131:167]
func (i *IBazel) handleSignals() {
// Got an OS signal (SIGINT, SIGTERM, SIGHUP).
sig := <-i.sigs
if i.cmd == nil || !i.cmd.IsSubprocessRunning() {
osExit(3)
return
}
switch sig {
case syscall.SIGINT:
i.interruptCount++
switch {
case i.interruptCount > 2:
log.NewLine()
log.Fatal("Exiting from getting SIGINT 3 times")
osExit(3)
case i.interruptCount > 1:
i.cmd.Kill()
default:
go func() {
i.cmd.Terminate()
log.NewLine()
log.Log(exitMessages[sig])
}()
}
case syscall.SIGTERM, syscall.SIGHUP:
go func() {
i.cmd.Terminate()
log.NewLine()
log.Log(exitMessages[sig])
osExit(3)
}()
default:
log.Fatal("Got a signal that wasn't handled. Please file a bug against bazel-watcher that describes how you did this. This is a big problem.")
}
}