mirror of
https://github.com/Hilbis/Hilbish
synced 2025-04-02 19:53:23 +00:00
feat: Add command.exit signal to bait (#15)
This commit is contained in:
parent
71504c9990
commit
ad1be6b5f5
3
shell.go
3
shell.go
@ -24,6 +24,7 @@ func RunInput(input string) {
|
||||
// If it succeeds, add to history and prompt again
|
||||
readline.AddHistory(input)
|
||||
readline.SaveHistory(homedir + "/.hilbish-history")
|
||||
bait.Em.Emit("command.exit", nil)
|
||||
bait.Em.Emit("command.success", nil)
|
||||
return
|
||||
}
|
||||
@ -79,12 +80,14 @@ func RunInput(input string) {
|
||||
} 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)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user