commit 38b9f863cb0aa8a3efe755bfc65ebb80754de1fd
Author: Scott Kostyshak <[email protected]>
Date:   Wed Jul 2 15:46:54 2025 +0200

    lyxbuild: finish command chain even if error
    
    Now the sequence of "&&" commands is completed even if there is an
    error from 'cmake' or 'make', which is important for being able to
    reproduce the error.
---
 development/lyx-tester/lyxbuild | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/development/lyx-tester/lyxbuild b/development/lyx-tester/lyxbuild
index b49eb8b01b..b90df4002a 100755
--- a/development/lyx-tester/lyxbuild
+++ b/development/lyx-tester/lyxbuild
@@ -470,7 +470,20 @@ fi
 echo "$(ECHOPREFIX)removing previous build logs..."
 [ -d "${LOGS_D}" ] && rm -rf "${LOGS_D}"
 mkdir "${LOGS_D}"
-
+#
+#
+# The point of centralizing this code is to finish the chain of commands
+# in 'build-commands', which is delimited by '&&'. Otherwise, the last
+# command will end with "&&" and will not be complete.
+# We do not just run this echo at the end of the script, because if there
+# is an error from 'cmake' or 'make' we want build-commands to be complete
+# to reproduce that error.
+function on_exit () {
+  echo "echo 'all done.'" >> "${LOGS_D}/build-commands"
+}
+trap "on_exit" EXIT
+#
+#
 echo "Arguments to lyxbuild: ${args_orig}" >> "${LOGS_D}/misc.log"
 
 # Start timing here for profiling.
@@ -777,6 +790,7 @@ else
     || { echo "$(ERRORPREFIX)running cmake" >&2; exit 1; }
 fi
 
+
 echo "$(ECHOPREFIX)running make..."
 echo "$(ECHOPREFIX)building with ${njobs} core(s)" >> "${LOGS_D}/make.log"
 runthis make.log make -j${njobs} 2>&1
@@ -910,8 +924,4 @@ if [ "${bisect}" = "1" ] && [ "${patch_old}" = "1" ]; then
   git checkout "${hash_orig}"
 fi
 
-# this is mostly to close the chain, because runthis appends "&&" to every
-# command line stored in build-commands.
-echo "echo 'all done.'" >> "${LOGS_D}/build-commands"
-
 echo "$(ECHOPREFIX)done."
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to