Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65795396 authored by Zhuoyao Zhang's avatar Zhuoyao Zhang Committed by Automerger Merge Worker
Browse files

Merge "Move the impl of run_tool_with_logging into shell_utils.sh" into main...

Merge "Move the impl of run_tool_with_logging into shell_utils.sh" into main am: df1ba7c5 am: 99d5a16c

Original change: https://android-review.googlesource.com/c/platform/build/+/3109346



Change-Id: Id674e385717943f4fdc23744406055a9b8ee237c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c7527346 99d5a16c
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -126,4 +126,27 @@ function _wrap_build()
}


function log_tool_invocation()
{
    if [[ -z $ANDROID_TOOL_LOGGER ]]; then
        return
    fi

    LOG_TOOL_TAG=$1
    LOG_START_TIME=$(date +%s.%N)
    trap '
        exit_code=$?;
        # Remove the trap to prevent duplicate log.
        trap - EXIT;
        $ANDROID_TOOL_LOGGER \
                --tool_tag="${LOG_TOOL_TAG}" \
                --start_timestamp="${LOG_START_TIME}" \
                --end_timestamp="$(date +%s.%N)" \
                --tool_args="$*" \
                --exit_code="${exit_code}" \
                ${ANDROID_TOOL_LOGGER_EXTRA_ARGS} \
           > /dev/null 2>&1 &
        exit ${exit_code}
    ' SIGINT SIGTERM SIGQUIT EXIT
}