mirror of
https://github.com/Hilbis/Hilbish
synced 2025-03-13 18:00:41 +00:00
* refactor: use custom event emitter * fix: sigint hook emit on windows * fix: restore correct hilbish conf file * fix: call recoverer for go listeners * refactor(golibs/bait): use 1 map for listeners * feat: add once listeners, ability to remove listeners and remove listener on error * perf: reslice listener slice instead of trying to do ordered move with append * feat(bait): add release function to remove event listener * perf: remove listener directly from once emit instead of using off function * refactor: use bait event emitter on commander * docs(golibs/bait): add doc strings for functions * docs: set changelog * docs(golibs/bait): add docs for lua release function
24 lines
298 B
Go
24 lines
298 B
Go
// +build windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
)
|
|
|
|
func handleSignals() {
|
|
c := make(chan os.Signal)
|
|
signal.Notify(c, os.Interrupt)
|
|
|
|
for s := range c {
|
|
switch s {
|
|
case os.Interrupt:
|
|
hooks.Emit("signal.sigint")
|
|
if !running && interactive {
|
|
lr.ClearInput()
|
|
}
|
|
}
|
|
}
|
|
}
|