cmn: Kill
This commit is contained in:
parent
42145a82bd
commit
092eb701c7
|
@ -50,6 +50,12 @@ func TrapSignal(cb func()) {
|
||||||
select {}
|
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) {
|
func Exit(s string) {
|
||||||
fmt.Printf(s + "\n")
|
fmt.Printf(s + "\n")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
Loading…
Reference in New Issue