Page MenuHomeFreeBSD

D14658.id40720.diff
No OneTemporary

D14658.id40720.diff

Index: stand/lua/core.lua
===================================================================
--- stand/lua/core.lua
+++ stand/lua/core.lua
@@ -41,6 +41,23 @@
return cmd_name
end
+-- Globals
+function try_include(module)
+ local status, ret = pcall(require, module)
+ -- ret is the module if we succeeded.
+ if status then
+ return ret
+ end
+ -- Otherwise, ret is just a message; filter out ENOENT unless we're
+ -- doing a verbose load. As a consequence, try_include prior to loading
+ -- configuraiton will not display 'module not found'. All other errors
+ -- in loading will be printed.
+ if config.verbose or ret:match("^module .+ not found") == nil then
+ print(ret)
+ end
+ return nil
+end
+
-- Module exports
-- Commonly appearing constants
core.KEY_BACKSPACE = 8
Index: stand/lua/loader.lua
===================================================================
--- stand/lua/loader.lua
+++ stand/lua/loader.lua
@@ -43,11 +43,7 @@
end
local password = require("password")
-local result = lfs.attributes("/boot/lua/local.lua")
--- Effectively discard any errors; we'll just act if it succeeds.
-if result ~= nil then
- require("local")
-end
+try_include("local")
config.load()
if core.isUEFIBoot() then

File Metadata

Mime Type
text/plain
Expires
Tue, Jun 23, 2:32 AM (13 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34226082
Default Alt Text
D14658.id40720.diff (1 KB)

Event Timeline