1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-22 03:54:20 -05:00

shell-related cleanup and fixes.

This commit is contained in:
XeonSquared 2023-07-30 15:04:41 +10:00
parent b88134b70e
commit 87f8bd2149
2 changed files with 2 additions and 14 deletions

View File

@ -38,7 +38,7 @@ function shell.interactive()
if not f then if not f then
print("\27[31m"..r) print("\27[31m"..r)
else else
local rt = {pcall(f)} local rt = {xpcall(f,debug.traceback)}
local rs = table.remove(rt,1) local rs = table.remove(rt,1)
if not rs then io.write("\27[31m") end if not rs then io.write("\27[31m") end
for k,v in pairs(rt) do for k,v in pairs(rt) do

View File

@ -83,7 +83,7 @@ function shutil.df() -- Prints free disk space.
local fstr = "%-"..tostring(ml).."s %5s %5s" local fstr = "%-"..tostring(ml).."s %5s %5s"
print("fs"..(" "):rep(ml-2).." size used") print("fs"..(" "):rep(ml-2).." size used")
for k,v in pairs(mt) do 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))) print(string.format(fstr,v,wrapUnits(st),wrapUnits(su)))
end end
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()))) print(string.format("%5s %5s %5s",wrapUnits(computer.totalMemory()),wrapUnits(computer.totalMemory()-computer.freeMemory()),wrapUnits(computer.freeMemory())))
end 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) function shutil.which(name)
local fpath local fpath
for _,dir in ipairs(os.getenv("PATH")) do for _,dir in ipairs(os.getenv("PATH")) do