From 23b41893a3df6719eb75a4ee8bc54cd956fa8dd8 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 7 Jun 2026 23:28:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E9=80=80=E5=87=BA=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/otask.sh | 2 +- shell/share.sh | 2 +- shell/task.sh | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/shell/otask.sh b/shell/otask.sh index 071e6b61..f17d8100 100755 --- a/shell/otask.sh +++ b/shell/otask.sh @@ -373,4 +373,4 @@ if [[ $isJsOrPythonFile == 'true' ]]; then fi run_task_after "${task_shell_params[@]}" clear_env -handle_task_end "${task_shell_params[@]}" "$_task_exit_code" +handle_task_end "${task_shell_params[@]}" diff --git a/shell/share.sh b/shell/share.sh index 1959b7a3..881548fb 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -388,7 +388,7 @@ handle_task_end() { local end_time=$(format_time "$time_format" "$etime") local end_timestamp=$(format_timestamp "$time_format" "$etime") local diff_time=$(($end_timestamp - $begin_timestamp)) - local exit_code="${@: -1}" + local exit_code="${_task_exit_code:-0}" [[ "$diff_time" == 0 ]] && diff_time=1 if [[ $ID ]]; then diff --git a/shell/task.sh b/shell/task.sh index 07c23c5a..ec18ce1a 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -6,7 +6,9 @@ dir_shell=$QL_DIR/shell trap "single_hanle" 2 3 20 15 14 19 1 single_hanle() { - eval MANUAL=true handle_task_end "$@" "$cmd" + _task_exit_code="${_task_exit_code:-$?}" + [[ "$_task_exit_code" == "0" ]] && _task_exit_code="1" + eval MANUAL=true handle_task_end "$@" exit 1 }