mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-24 18:07:01 +00:00
Give the kill signal time to be delivered
This commit is contained in:
parent
a939bbb3ec
commit
fa4711bd04
1 changed files with 9 additions and 3 deletions
|
|
@ -273,14 +273,20 @@ func (self *Loop) ScreenSize() (ScreenSize, error) {
|
|||
return self.screen_size, err
|
||||
}
|
||||
|
||||
func kill_self(sig unix.Signal) {
|
||||
unix.Kill(os.Getpid(), sig)
|
||||
// Give the signal time to be delivered
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
}
|
||||
|
||||
func (self *Loop) KillIfSignalled() {
|
||||
switch self.death_signal {
|
||||
case SIGINT:
|
||||
unix.Kill(os.Getpid(), unix.SIGINT)
|
||||
kill_self(unix.SIGINT)
|
||||
case SIGTERM:
|
||||
unix.Kill(os.Getpid(), unix.SIGTERM)
|
||||
kill_self(unix.SIGTERM)
|
||||
case SIGHUP:
|
||||
unix.Kill(os.Getpid(), unix.SIGHUP)
|
||||
kill_self(unix.SIGHUP)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue