lush no longer forks or calls login, has a configurable prompt

This commit is contained in:
Izaya 2017-10-08 01:35:18 +11:00
parent d736491628
commit c5307a7433

View File

@ -1,20 +1,20 @@
local tA = {...} local tA = {...}
local si = tA[1] local si = tA[1] or os.getenv("sI")
spawn("lua shell", function() print(pcall(function() os.setenv("sI",si)
os.setenv("sI",si) _ENV = shutil.genenv()
_ENV = shutil.genenv() print("lush v1/".._VERSION)
coroutine.yield() os.setenv("PSF",function()
log(pcall(login)) local ps = "["..os.getuid().."@"..net.id.." "..(os.getenv("PWD") or "").."]"
print("lush v1/".._VERSION) if os.getuid() == "superuser" then ps = ps .. "# " else ps = ps .. "$ " end
while true do return ps end)
local didexec = false while true do
write((os.getenv("PWD") or "").."> ") local didexec = false
local inp=readln() write(os.getenv("PSF")())
if not inp then break end local inp=readln()
local rt = {shutil.exec(inp)} if not inp then break end
if rt[1] == true then local rt = {shutil.exec(inp)}
table.remove(rt,1) if rt[1] == true then
end table.remove(rt,1)
print(table.unpack(rt))
end end
end)) end) print(table.unpack(rt))
end