mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-10 22:24:24 +02:00
More work on porting receive kitten
This commit is contained in:
@@ -98,6 +98,12 @@ type Loop struct {
|
||||
|
||||
// Called when main loop is woken up
|
||||
OnWakeup func() error
|
||||
|
||||
// Called on SIGINT return true if you wish to handle it yourself
|
||||
OnSIGINT func() (bool, error)
|
||||
|
||||
// Called on SIGTERM return true if you wish to handle it yourself
|
||||
OnSIGTERM func() (bool, error)
|
||||
}
|
||||
|
||||
func New(options ...func(self *Loop)) (*Loop, error) {
|
||||
|
||||
@@ -198,12 +198,22 @@ func (self *Loop) handle_end_of_bracketed_paste() {
|
||||
func (self *Loop) on_signal(s unix.Signal) error {
|
||||
switch s {
|
||||
case unix.SIGINT:
|
||||
if self.OnSIGINT != nil {
|
||||
if handled, err := self.OnSIGINT(); handled {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return self.on_SIGINT()
|
||||
case unix.SIGPIPE:
|
||||
return self.on_SIGPIPE()
|
||||
case unix.SIGWINCH:
|
||||
return self.on_SIGWINCH()
|
||||
case unix.SIGTERM:
|
||||
if self.OnSIGTERM != nil {
|
||||
if handled, err := self.OnSIGTERM(); handled {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return self.on_SIGTERM()
|
||||
case unix.SIGTSTP:
|
||||
return self.on_SIGTSTP()
|
||||
|
||||
Reference in New Issue
Block a user