forked from izaya/OC-PsychOS2
shell-related cleanup and fixes.
This commit is contained in:
parent
b88134b70e
commit
87f8bd2149
@ -38,7 +38,7 @@ function shell.interactive()
|
||||
if not f then
|
||||
print("\27[31m"..r)
|
||||
else
|
||||
local rt = {pcall(f)}
|
||||
local rt = {xpcall(f,debug.traceback)}
|
||||
local rs = table.remove(rt,1)
|
||||
if not rs then io.write("\27[31m") end
|
||||
for k,v in pairs(rt) do
|
||||
|
@ -83,7 +83,7 @@ function shutil.df() -- Prints free disk space.
|
||||
local fstr = "%-"..tostring(ml).."s %5s %5s"
|
||||
print("fs"..(" "):rep(ml-2).." size used")
|
||||
for k,v in pairs(mt) do
|
||||
local st, su = fs.spaceTotal(v.."/."), fs.spaceUsed(v.."/.")
|
||||
local st, su = fs.spaceTotal("/"..v), fs.spaceUsed("/"..v)
|
||||
print(string.format(fstr,v,wrapUnits(st),wrapUnits(su)))
|
||||
end
|
||||
end
|
||||
@ -119,18 +119,6 @@ function shutil.free() -- Displays used and free memory.
|
||||
print(string.format("%5s %5s %5s",wrapUnits(computer.totalMemory()),wrapUnits(computer.totalMemory()-computer.freeMemory()),wrapUnits(computer.freeMemory())))
|
||||
end
|
||||
|
||||
local function pread(self,len)
|
||||
syslog(tostring(self))
|
||||
syslog(tostring(len))
|
||||
io.input(self.input)
|
||||
local b = io.read(len)
|
||||
io.input(self)
|
||||
if b:match("\3") then
|
||||
error("terminated")
|
||||
end
|
||||
return b
|
||||
end
|
||||
|
||||
function shutil.which(name)
|
||||
local fpath
|
||||
for _,dir in ipairs(os.getenv("PATH")) do
|
||||
|
Loading…
Reference in New Issue
Block a user