From a2ec7136037194f5ca8edfdcd7bd8b62c38dea2a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 24 Jul 2026 12:23:23 -0700 Subject: [PATCH] Collapse the duplicated run_logged invocation branches Co-Authored-By: Claude Opus 5 (1M context) --- install/helpers/logging.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/install/helpers/logging.sh b/install/helpers/logging.sh index e325d83e..1ba6edba 100644 --- a/install/helpers/logging.sh +++ b/install/helpers/logging.sh @@ -51,20 +51,17 @@ run_logged() { ;; esac + local runner=(bash -eE) + if [[ ${OMARCHY_INSTALL_DEBUG:-} == "1" ]]; then + runner=(bash -x -eE) + fi + if omarchy_log_to_stdout; then - if [[ ${OMARCHY_INSTALL_DEBUG:-} == "1" ]]; then - PS4='+ ${BASH_SOURCE[0]##*/}:${LINENO}:${FUNCNAME[0]:-main}: ' \ - bash -x -eE -c 'source "$1"' bash "$script" &1 - else - bash -eE -c 'source "$1"' bash "$script" &1 - fi + PS4='+ ${BASH_SOURCE[0]##*/}:${LINENO}:${FUNCNAME[0]:-main}: ' \ + "${runner[@]}" -c 'source "$1"' bash "$script" &1 else - if [[ ${OMARCHY_INSTALL_DEBUG:-} == "1" ]]; then - PS4='+ ${BASH_SOURCE[0]##*/}:${LINENO}:${FUNCNAME[0]:-main}: ' \ - bash -x -eE -c 'source "$1"' bash "$script" >"$OMARCHY_INSTALL_LOG_FILE" 2>&1 - else - bash -eE -c 'source "$1"' bash "$script" >"$OMARCHY_INSTALL_LOG_FILE" 2>&1 - fi + PS4='+ ${BASH_SOURCE[0]##*/}:${LINENO}:${FUNCNAME[0]:-main}: ' \ + "${runner[@]}" -c 'source "$1"' bash "$script" >"$OMARCHY_INSTALL_LOG_FILE" 2>&1 fi exit_code=$?