From 092eb701c7276907cdbed258750e22ce895b6735 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 27 Oct 2017 11:01:40 -0400 Subject: [PATCH] cmn: Kill --- common/os.go | 6 ++++++ 1 file changed, 6 insertions(+) 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)