git: 7ffa3b0f69dc - stable/14 - Revert "loader/lua: Remove workaround for command_error"

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 01 Aug 2024 14:50:29 UTC
The branch stable/14 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=7ffa3b0f69dcd59dc16dd652744a0d52d84954ed

commit 7ffa3b0f69dcd59dc16dd652744a0d52d84954ed
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-07-29 22:57:13 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-08-01 14:49:54 +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
    
    (cherry picked from commit 809edb3636a5494ad7d3dfff910e0aab89d83442)
---
 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