From c12fd1a8b49848f05bb824b4c2628c3fa5a63bd1 Mon Sep 17 00:00:00 2001 From: sammyette <38820196+TorchedSammy@users.noreply.github.com> Date: Thu, 21 Oct 2021 20:49:28 -0400 Subject: [PATCH] fix: let sh interp handle registered commanders --- shell.go | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/shell.go b/shell.go index 14dd4c4..c779a68 100644 --- a/shell.go +++ b/shell.go @@ -53,35 +53,6 @@ func RunInput(input string) { cmdFinish(0, cmdString) return } - if commands[cmdArgs[0]] != nil { - luacmdArgs := l.NewTable() - for _, str := range cmdArgs[1:] { - luacmdArgs.Append(lua.LString(str)) - } - - err := l.CallByParam(lua.P{ - Fn: commands[cmdArgs[0]], - NRet: 1, - Protect: true, - }, luacmdArgs) - if err != nil { - fmt.Fprintln(os.Stderr, - "Error in command:\n\n" + err.Error()) - cmdFinish(1, cmdString) - return - } - luaexitcode := l.Get(-1) - var exitcode uint8 = 0 - - l.Pop(1) - - if code, ok := luaexitcode.(lua.LNumber); luaexitcode != lua.LNil && ok { - exitcode = uint8(code) - } - - cmdFinish(exitcode, cmdString) - return - } // Last option: use sh interpreter err = execCommand(cmdString)