Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160197597
D14658.id40720.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D14658.id40720.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D14658: liblua: Implement try_include and use it for inclusion of the local module
Attached
Detach File
Event Timeline
Log In to Comment