修改 task 命令超时时间判断

This commit is contained in:
whyour 2023-05-01 11:05:36 +08:00
parent 1f8f35476a
commit df1addc1ff

View File

@ -34,7 +34,7 @@ define_program() {
handle_log_path() { handle_log_path() {
local file_param=$1 local file_param=$1
if [[ -z $file_param ]];then if [[ -z $file_param ]]; then
file_param="task" file_param="task"
fi fi
@ -76,9 +76,11 @@ format_params() {
mtime_format="%Y-%m-%d %H:%M:%S.%3N" mtime_format="%Y-%m-%d %H:%M:%S.%3N"
fi fi
timeoutCmd="" timeoutCmd=""
if [[ $command_timeout_time ]]; then
if type timeout &>/dev/null; then if type timeout &>/dev/null; then
timeoutCmd="timeout --foreground -s 2 -k 10s $command_timeout_time " timeoutCmd="timeout --foreground -s 2 -k 10s $command_timeout_time "
fi fi
fi
# params=$(echo "$@" | sed -E 's/([^ ])&([^ ])/\1\\\&\2/g') # params=$(echo "$@" | sed -E 's/([^ ])&([^ ])/\1\\\&\2/g')
} }