1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-07 03:00:39 +00:00

Enhanced optimization for better use

This commit is contained in:
Tw93
2025-12-08 15:40:39 +08:00
parent 78e6743666
commit 9e7fc41445
4 changed files with 30 additions and 10 deletions

View File

@@ -81,7 +81,7 @@ run_with_timeout() {
shift || true
# No timeout if duration is invalid or zero
if [[ ! "$duration" =~ ^[0-9]+$ ]] || [[ "$duration" -le 0 ]]; then
if [[ ! "$duration" =~ ^[0-9]+(\.[0-9]+)?$ ]] || [[ $(echo "$duration <= 0" | bc -l 2> /dev/null) -eq 1 ]]; then
"$@"
return $?
fi