OctOS: Improve error handling
Commands run and code called with the `lua` command would not throw an error if it was unsucessful.master
parent
662c265cab
commit
5d59142b10
|
@ -1,8 +1,8 @@
|
|||
local params = ...
|
||||
local code = (table.concat(params, " "))
|
||||
|
||||
local res = run(code)
|
||||
local ok, res = run(code)
|
||||
|
||||
if not res then
|
||||
print("Error: Could not run `"..code.."`")
|
||||
if not ok then
|
||||
print("Error: "..res)
|
||||
end
|
||||
|
|
|
@ -10,7 +10,11 @@ if input[1] ~= "" then
|
|||
-- Remove first param
|
||||
table.remove(input, 1)
|
||||
|
||||
fs.run(binentry.exec, input)
|
||||
local ok, res = fs.run(binentry.exec, input)
|
||||
|
||||
if not ok then
|
||||
print("Error: "..res)
|
||||
end
|
||||
else
|
||||
print(input[1]..": command not found")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue