From 87f8bd214913c2229457c50178d8ea11578e90bc Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Sun, 30 Jul 2023 15:04:41 +1000 Subject: [PATCH] shell-related cleanup and fixes. --- lib/shell.lua | 2 +- lib/shutil.lua | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/shell.lua b/lib/shell.lua index fa444fe..6af9adf 100644 --- a/lib/shell.lua +++ b/lib/shell.lua @@ -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 diff --git a/lib/shutil.lua b/lib/shutil.lua index ece7a74..5f2ffbd 100644 --- a/lib/shutil.lua +++ b/lib/shutil.lua @@ -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