git: 809edb3636a5 - main - Revert "loader/lua: Remove workaround for command_error"

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 29 Jul 2024 22:57:30 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=809edb3636a5494ad7d3dfff910e0aab89d83442

commit 809edb3636a5494ad7d3dfff910e0aab89d83442
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-07-29 22:57:13 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-07-29 22:57:13 +0000

    Revert "loader/lua: Remove workaround for command_error"
    
    This reverts commit 552f3072af54820cf1805f712e2567bc1b7f046d.
    
    loader.command_error was added just after 11.2, but appears to not have
    been back ported to 11.x. 11.0 was the first lua loader release, so keep
    this compat shim until we sort out what to do.
    
    MFC After:              3 days
    Sponsored by:           Netflix
    Reviewed by:            kevans
    Differential Revision:  https://reviews.freebsd.org/D45883
---
 stand/lua/config.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/stand/lua/config.lua b/stand/lua/config.lua
index ba6144364247..86f5ef6174a2 100644
--- a/stand/lua/config.lua
+++ b/stand/lua/config.lua
@@ -407,7 +407,12 @@ local function loadModule(mod, silent)
 			end
 
 			if cli_execute_unparsed(str) ~= 0 then
-				print(loader.command_error())
+				-- XXX Temporary shim: don't break the boot if
+				-- loader hadn't been recompiled with this
+				-- function exposed.
+				if loader.command_error then
+					print(loader.command_error())
+				end
 				if not silent then
 					print("failed!")
 				end