fix: set hilbish.exitCode to last command exit code

lua5.4
TorchedSammy 2022-04-02 12:13:56 -04:00
parent dd52fd2ad9
commit 24d0b8ead7
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ import (
"syscall" "syscall"
"time" "time"
// "hilbish/util" "hilbish/util"
rt "github.com/arnodel/golua/runtime" rt "github.com/arnodel/golua/runtime"
"mvdan.cc/sh/v3/shell" "mvdan.cc/sh/v3/shell"
@ -437,7 +437,7 @@ func cmdFinish(code uint8, cmdstr string, private bool) {
if interactive && !private { if interactive && !private {
handleHistory(cmdstr) handleHistory(cmdstr)
} }
// util.SetField(l, hshMod, "exitCode", lua.LNumber(code), "Exit code of last exected command") util.SetField(l, hshMod, "exitCode", rt.IntValue(int64(code)), "Exit code of last exected command")
// using AsValue (to convert to lua type) on an interface which is an int // using AsValue (to convert to lua type) on an interface which is an int
// results in it being unknown in lua .... ???? // results in it being unknown in lua .... ????
// so we allow the hook handler to take lua runtime Values // so we allow the hook handler to take lua runtime Values