toolfixes

This commit is contained in:
2025-09-25 11:49:12 +02:00
parent d529d53827
commit 404e421411
1023 changed files with 51 additions and 328793 deletions

View File

@@ -52,29 +52,37 @@ function log_debug() {
# Command execution with full transparency
function safe_execute() {
local cmd="$*"
log_info "Executing: ${cmd}"
# Stream output live when DEBUG=1 or inside container; otherwise capture and emit only on error.
local cmd_display="$*"
log_info "Executing: ${cmd_display}"
if [[ "${DEBUG:-0}" == "1" ]] || in_container; then
# In debug mode or container, show all output for visibility
if ! ${cmd}; then
log_error "Command failed: ${cmd}"
if ! "$@"; then
log_error "Command failed: ${cmd_display}"
exit 1
fi
else
# Normal mode, capture output and show only on error
local output
if ! output=$(${cmd} 2>&1); then
log_error "Command failed: ${cmd}"
if ! output=$("$@" 2>&1); then
log_error "Command failed: ${cmd_display}"
log_error "Output: ${output}"
exit 1
else
# Show minimal progress indicator for non-debug mode
log_debug "Command completed successfully: ${cmd}"
log_debug "Command completed successfully: ${cmd_display}"
fi
fi
}
# Always-streaming variant (forces live stdout/stderr regardless of DEBUG)
function safe_execute_stream() {
local cmd_display="$*"
log_info "Executing (stream): ${cmd_display}"
if ! "$@"; then
log_error "Command failed: ${cmd_display}"
exit 1
fi
}
# Section headers with clear text separators
function section_header() {
local title="$1"
@@ -263,7 +271,7 @@ fi
export SCRIPT_DIR PROJECT_ROOT
export INSTALL_DIR COMPONENTS_DIR KERNEL_DIR DIST_DIR
export -f log_info log_warn log_error log_debug
export -f safe_execute section_header
export -f safe_execute safe_execute_stream section_header
export -f command_exists in_container check_dependencies
export -f safe_mkdir safe_rmdir safe_copy
export -f is_absolute_path resolve_path get_file_size wait_for_file