修复任务命令中的&和引号

This commit is contained in:
whyour 2022-11-02 18:51:09 +08:00
parent 8f90d3f8ff
commit 802b2d722e
2 changed files with 7 additions and 6 deletions

View File

@ -232,8 +232,7 @@ run_else() {
shift
local params=$(echo "$@" | sed 's/ /\" \"/g')
$timeoutCmd $which_program $file_param \"$params\"
$timeoutCmd $which_program $file_param "$@"
}
## 命令检测

View File

@ -58,6 +58,7 @@ format_params() {
if type timeout &>/dev/null; then
timeoutCmd="timeout -k 10s $command_timeout_time "
fi
params=$(echo "$@" | sed 's/&/\\&/g')
}
show_log="false"
@ -70,10 +71,11 @@ while getopts ":l" opt; do
done
[[ "$show_log" == "true" ]] && shift $(($OPTIND - 1))
format_params
define_program "$@"
handle_log_path "$@"
eval . $dir_shell/otask.sh "$@" "$cmd"
format_params "$@"
define_program "$params"
handle_log_path "$params"
eval . $dir_shell/otask.sh "$params" "$cmd"
[[ -f "$dir_log/$log_path" ]] && cat "$dir_log/$log_path"
exit 0