mirror of https://github.com/Hilbis/Hilbish
fix: panic when error occurs in commander
check if commander has an error before trying to get a return codedev
parent
af4c3885ae
commit
c61b428d67
11
shell.go
11
shell.go
|
@ -124,6 +124,13 @@ func execCommand(cmd string) error {
|
|||
NRet: 1,
|
||||
Protect: true,
|
||||
}, luacmdArgs)
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr,
|
||||
"Error in command:\n\n" + err.Error())
|
||||
return interp.NewExitStatus(1)
|
||||
}
|
||||
|
||||
luaexitcode := l.Get(-1)
|
||||
var exitcode uint8 = 0
|
||||
|
||||
|
@ -133,10 +140,6 @@ func execCommand(cmd string) error {
|
|||
exitcode = uint8(code)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr,
|
||||
"Error in command:\n\n" + err.Error())
|
||||
}
|
||||
cmdFinish(exitcode, argstring)
|
||||
return interp.NewExitStatus(exitcode)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue