sergehuber commented on code in PR #770:
URL: https://github.com/apache/unomi/pull/770#discussion_r3369848855


##########
build.sh:
##########
@@ -985,16 +1034,25 @@ $MVN_CMD clean $MVN_OPTS || {
     exit 1
 }
 
+if [ "$RUN_INTEGRATION_TESTS" = true ]; then
+    write_it_run_trace_start
+fi
+
 print_progress $((++current_step)) $total_steps "Compiling and installing 
artifacts..."
 if [ "$HAS_COLORS" -eq 1 ]; then
     echo -e "${GRAY}Running: $MVN_CMD install $MVN_OPTS${NC}"
 else
     echo "Running: $MVN_CMD install $MVN_OPTS"
 fi
-$MVN_CMD install $MVN_OPTS || {
+$MVN_CMD install $MVN_OPTS
+INSTALL_EXIT=$?
+if [ "$RUN_INTEGRATION_TESTS" = true ]; then
+    finalize_it_run_trace "$INSTALL_EXIT"
+fi
+if [ "$INSTALL_EXIT" -ne 0 ]; then
     print_status "error" "Maven install failed"
     exit 1
-}
+fi

Review Comment:
   Fixed. `mvn install` is now invoked as `INSTALL_EXIT=0; $MVN_CMD install 
$MVN_OPTS || INSTALL_EXIT=$?`. The `||` prevents `set -e` from firing, the exit 
code is captured reliably, and `finalize_it_run_trace "$INSTALL_EXIT"` runs 
regardless of whether the build succeeded.



##########
itests/lib/it-run-ui.sh:
##########
@@ -0,0 +1,255 @@
+# Presentation layer for IT run tooling (sourced, not executed directly).
+
+UI_USE_COLOR=0
+UI_SPINNER_PID=""
+
+ui_init() {
+    UI_USE_COLOR=0
+    if [ -t 1 ] && [ -z "${NO_COLOR:-}" ] && [ -z "${CI:-}" ]; then
+        UI_USE_COLOR=1
+    fi
+}
+
+ui__color_enabled() {
+    [ "$UI_USE_COLOR" -eq 1 ]
+}
+
+ui__fg() {
+    local code="$1"
+    ui__color_enabled && printf '\033[%sm' "$code"
+}
+
+ui__reset() { ui__fg 0; }
+ui__bold()  { ui__fg 1; }
+ui__dim()   { ui__fg 2; }
+ui__red()   { ui__fg 31; }
+ui__grn()   { ui__fg 32; }
+ui__ylw()   { ui__fg 33; }
+ui__blu()   { ui__fg 34; }
+ui__mag()   { ui__fg 35; }
+ui__cyn()   { ui__fg 36; }
+
+ui__line() {
+    local glyph="$1"
+    local color_fn="$2"
+    local indent="$3"
+    local message="$4"
+    local stream="${5:-1}"
+    local plain_label="${6:-}"
+
+    if ui__color_enabled; then
+        $color_fn
+        printf '%s%s ' "$indent" "$glyph"
+        ui__reset
+        printf '%s\n' "$message" >&"$stream"
+    elif [ "$stream" -eq 2 ]; then
+        printf '%s: %s\n' "$plain_label" "$message" >&2
+    else
+        printf '%s%s\n' "$indent" "$message"
+    fi

Review Comment:
   Fixed. All parts of the line (color escape, glyph, message, reset) are now 
emitted as a single group redirect: `{ $color_fn; printf '%s%s ' "$indent" 
"$glyph"; ui__reset; printf '%s\n' "$message"; } >&"$stream"`. Note: the file 
has since been moved to `itests/lib/it-run-ui.sh`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to