mirror of https://github.com/Hilbis/Hilbish
fix: handle error before getting commander exit code
this fixes a register underflow issue if a commander causes an errorpull/69/head
parent
36ea20b550
commit
30ffe9cab0
10
shell.go
10
shell.go
|
@ -56,6 +56,12 @@ func RunInput(input string) {
|
|||
NRet: 1,
|
||||
Protect: true,
|
||||
}, luar.New(l, cmdArgs[1:]))
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr,
|
||||
"Error in command:\n\n" + err.Error())
|
||||
hooks.Em.Emit("command.exit", 1)
|
||||
return
|
||||
}
|
||||
luaexitcode := l.Get(-1)
|
||||
var exitcode uint8 = 0
|
||||
|
||||
|
@ -65,10 +71,6 @@ func RunInput(input string) {
|
|||
exitcode = uint8(code)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr,
|
||||
"Error in command:\n\n" + err.Error())
|
||||
}
|
||||
hooks.Em.Emit("command.exit", exitcode)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue