mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-10 07:45:05 -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 args = shell.parse(...)
|
||||||
|
|
||||||
|
local t = type
|
||||||
|
|
||||||
shell.prime()
|
shell.prime()
|
||||||
|
|
||||||
if #args == 0 then
|
if #args == 0 then
|
||||||
@ -19,6 +21,7 @@ if #args == 0 then
|
|||||||
if tty.getCursor() > 1 then
|
if tty.getCursor() > 1 then
|
||||||
io.write("\n")
|
io.write("\n")
|
||||||
end
|
end
|
||||||
|
io.write("type:", t(type), '\n')
|
||||||
io.write(sh.expand(os.getenv("PS1") or "$ "))
|
io.write(sh.expand(os.getenv("PS1") or "$ "))
|
||||||
end
|
end
|
||||||
tty.window.cursor = input_handler
|
tty.window.cursor = input_handler
|
||||||
@ -31,8 +34,8 @@ if #args == 0 then
|
|||||||
elseif command ~= "" then
|
elseif command ~= "" then
|
||||||
--luacheck: globals _ENV
|
--luacheck: globals _ENV
|
||||||
local result, reason = sh.execute(_ENV, command)
|
local result, reason = sh.execute(_ENV, command)
|
||||||
if not result then
|
if not result and reason then
|
||||||
io.stderr:write((reason and tostring(reason) or "unknown error") .. "\n")
|
io.stderr:write(tostring(reason), "\n")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif command == nil then -- false only means the input was interrupted
|
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
|
if type(words) ~= "table" then
|
||||||
return words, reason
|
return words, reason
|
||||||
elseif #words == 0 then
|
elseif #words == 0 then
|
||||||
return true, 0
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- MUST be table.pack for non contiguous ...
|
-- MUST be table.pack for non contiguous ...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user