Browse Source

cmn: Kill

pull/1842/head
Ethan Buchman 7 years ago
parent
commit
092eb701c7
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      common/os.go

+ 6
- 0
common/os.go 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)


Loading…
Cancel
Save