2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-05-10 22:33:22 +00:00

feat: Add command.exit signal to bait

This commit is contained in:
Jack Johannesen 2021-04-03 14:12:42 -04:00
parent 23f6986123
commit c8d2c47319

View File

@ -108,6 +108,7 @@ func main() {
if err == nil {
// If it succeeds, add to history and prompt again
readline.AddHistory(cmdString)
bait.Em.Emit("command.exit", nil)
bait.Em.Emit("command.success", nil)
continue
}
@ -162,12 +163,14 @@ func main() {
} else {
if code, ok := interp.IsExitStatus(err); ok {
if code > 0 {
bait.Em.Emit("command.exit", nil)
bait.Em.Emit("command.fail", code)
}
}
fmt.Fprintln(os.Stderr, err)
}
} else {
bait.Em.Emit("command.exit", nil)
bait.Em.Emit("command.success", nil)
}
}