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,
|
NRet: 1,
|
||||||
Protect: true,
|
Protect: true,
|
||||||
}, luacmdArgs)
|
}, luacmdArgs)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr,
|
||||||
|
"Error in command:\n\n" + err.Error())
|
||||||
|
return interp.NewExitStatus(1)
|
||||||
|
}
|
||||||
|
|
||||||
luaexitcode := l.Get(-1)
|
luaexitcode := l.Get(-1)
|
||||||
var exitcode uint8 = 0
|
var exitcode uint8 = 0
|
||||||
|
|
||||||
|
@ -133,10 +140,6 @@ func execCommand(cmd string) error {
|
||||||
exitcode = uint8(code)
|
exitcode = uint8(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintln(os.Stderr,
|
|
||||||
"Error in command:\n\n" + err.Error())
|
|
||||||
}
|
|
||||||
cmdFinish(exitcode, argstring)
|
cmdFinish(exitcode, argstring)
|
||||||
return interp.NewExitStatus(exitcode)
|
return interp.NewExitStatus(exitcode)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue