tiny cleanup in shell for crashed scripts

remove unknown error message
This commit is contained in:
payonel 2020-05-14 20:18:38 -07:00
parent 310120df31
commit 5cb4dc5537
2 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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 ...