feat: allow hilbish.runner.sh to be overridden

cancel-commander
TorchedSammy 2022-08-30 23:07:24 -04:00
parent a1ce2ecba6
commit c96605e79c
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 12 additions and 2 deletions

12
exec.go
View File

@ -221,7 +221,17 @@ func handleLua(cmdString string) (string, uint8, error) {
return cmdString, 125, err
}
func handleSh(cmdString string) (string, uint8, bool, error) {
func handleSh(cmdString string) (input string, exitCode uint8, cont bool, runErr error) {
shRunner := hshMod.Get(rt.StringValue("runner")).AsTable().Get(rt.StringValue("sh"))
var err error
input, exitCode, cont, runErr, err = runLuaRunner(shRunner, cmdString)
if err != nil {
runErr = err
}
return
}
func execSh(cmdString string) (string, uint8, bool, error) {
_, _, err := execCommand(cmdString, true)
if err != nil {
// If input is incomplete, start multiline prompting

View File

@ -28,7 +28,7 @@ func shRunner(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
return nil, err
}
input, exitCode, cont, err := handleSh(cmd)
input, exitCode, cont, err := execSh(cmd)
var luaErr rt.Value = rt.NilValue
if err != nil {
luaErr = rt.StringValue(err.Error())