cmn: Kill

This commit is contained in:
Ethan Buchman 2017-10-27 11:01:40 -04:00
parent 42145a82bd
commit 092eb701c7
1 changed files with 6 additions and 0 deletions

View File

@ -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)