From ad1be6b5f5d6e6cc9e4667ce6e374026d3d93ff0 Mon Sep 17 00:00:00 2001 From: Jack Date: Sat, 3 Apr 2021 14:33:38 -0400 Subject: [PATCH] feat: Add command.exit signal to bait (#15) --- shell.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell.go b/shell.go index 12519bf..7f19408 100644 --- a/shell.go +++ b/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) } }