mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 18:30:27 -04:00
Clean io mode for sh.lua
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
parent
82e57b507b
commit
4cedbb41e7
@ -253,6 +253,23 @@ if #args == 0 and (io.input() == io.stdin or options.i) and not options.c then
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif #args == 0 and (io.input() ~= io.stdin) then
|
||||
while true do
|
||||
io.write(expand(os.getenv("PS1") or "$ "))
|
||||
local command = io.read("*l")
|
||||
if not command then
|
||||
io:write("exit\n")
|
||||
end
|
||||
command = text.trim(command)
|
||||
if command == "exit" then
|
||||
return
|
||||
elseif command ~= "" then
|
||||
local result, reason = os.execute(command)
|
||||
if not result then
|
||||
io.stderr:write((tostring(reason) or "unknown error").. "\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
-- execute command.
|
||||
local result = table.pack(execute(...))
|
||||
|
Loading…
x
Reference in New Issue
Block a user