mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-09 07:15:11 -04:00
tiny cleanup in shell for crashed scripts
remove unknown error message
This commit is contained in:
parent
310120df31
commit
5cb4dc5537
@ -5,6 +5,8 @@ local sh = require("sh")
|
||||
|
||||
local args = shell.parse(...)
|
||||
|
||||
local t = type
|
||||
|
||||
shell.prime()
|
||||
|
||||
if #args == 0 then
|
||||
@ -19,6 +21,7 @@ if #args == 0 then
|
||||
if tty.getCursor() > 1 then
|
||||
io.write("\n")
|
||||
end
|
||||
io.write("type:", t(type), '\n')
|
||||
io.write(sh.expand(os.getenv("PS1") or "$ "))
|
||||
end
|
||||
tty.window.cursor = input_handler
|
||||
@ -31,8 +34,8 @@ if #args == 0 then
|
||||
elseif command ~= "" then
|
||||
--luacheck: globals _ENV
|
||||
local result, reason = sh.execute(_ENV, command)
|
||||
if not result then
|
||||
io.stderr:write((reason and tostring(reason) or "unknown error") .. "\n")
|
||||
if not result and reason then
|
||||
io.stderr:write(tostring(reason), "\n")
|
||||
end
|
||||
end
|
||||
elseif command == nil then -- false only means the input was interrupted
|
||||
|
@ -198,7 +198,7 @@ function sh.execute(env, command, ...)
|
||||
if type(words) ~= "table" then
|
||||
return words, reason
|
||||
elseif #words == 0 then
|
||||
return true, 0
|
||||
return true
|
||||
end
|
||||
|
||||
-- MUST be table.pack for non contiguous ...
|
||||
|
Loading…
x
Reference in New Issue
Block a user