v0.8.1 - Fixed a couple bugs involving the shell crashing and fetch. Added proper shell error handling.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
local loadfile = ...
|
||||
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
|
||||
|
||||
_G._OSVERSION = "Halyde 0.8.0"
|
||||
_G._OSVERSION = "Halyde 0.8.1"
|
||||
|
||||
function _G.import(module, ...)
|
||||
local args = table.pack(...)
|
||||
|
||||
+12
-1
@@ -41,6 +41,9 @@ function _G.shell.run(command)
|
||||
end
|
||||
-- execute the program
|
||||
local foundfile = false
|
||||
if not args[1] then
|
||||
return
|
||||
end
|
||||
if filesystem.exists(args[1]) then
|
||||
foundfile = true
|
||||
local path = args[1]
|
||||
@@ -60,7 +63,15 @@ function _G.shell.run(command)
|
||||
if args[1] == file:match("(.+)%.[^%.]+$") then
|
||||
foundfile = true
|
||||
table.remove(args, 1)
|
||||
import(item..file, table.unpack(args))
|
||||
local function runCommand()
|
||||
import(item..file, table.unpack(args))
|
||||
end
|
||||
local result, reason = xpcall(runCommand, function(errMsg)
|
||||
return errMsg .. "\n\n" .. debug.traceback()
|
||||
end)
|
||||
if not result then
|
||||
print("\27[91m" .. reason)
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,7 +41,13 @@ gpu.setBackground(defaultBackgroundColor)
|
||||
|
||||
local function scrollDown()
|
||||
if gpu.copy(0,1,width,height,0,-1) then
|
||||
gpu.set(1,height,string.rep(" ",width))
|
||||
local prevForeground = gpu.getForeground()
|
||||
local prevBackground = gpu.getBackground()
|
||||
gpu.setForeground(defaultForegroundColor)
|
||||
gpu.setBackground(defaultBackgroundColor)
|
||||
gpu.fill(1, height, width, 1, " ")
|
||||
gpu.setForeground(prevForeground)
|
||||
gpu.setBackground(prevBackground)
|
||||
termlib.cursorPosY=height
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user