diff --git a/common/os.go b/common/os.go index 6b591ce5..81f703c7 100644 --- a/common/os.go +++ b/common/os.go @@ -50,6 +50,12 @@ func TrapSignal(cb func()) { select {} } +// Kill the running process by sending itself SIGTERM +func Kill() error { + pid := os.Getpid() + return syscall.Kill(pid, syscall.SIGTERM) +} + func Exit(s string) { fmt.Printf(s + "\n") os.Exit(1)