Skip to content

Commit 122ce26

Browse files
wesgarlandXmader
authored andcommitted
peter-jr - improve timeout display, fix dynamic timeouts
1 parent 89fe5e3 commit 122ce26

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

peter-jr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ cd "$runDir"
2121
set -u
2222
set -o pipefail
2323
peter_exit_code=2
24+
defaultTimeout="${defaultTimeout:-15}"
2425

2526
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
2627
cat <<EOF
@@ -160,13 +161,14 @@ findTests \
160161
FAIL="$(red FAIL)"
161162
fi
162163
(
164+
timeout=$(egrep '^( *[*#] *timeout: )' "$file" | head -1 | sed -e 's/^\( *[*#] *timeout: \)//')
163165
case "$testType" in
164166
"simple")
165-
"${PMJS}" "$file"
167+
eval timeout -s9 "${timeout:-${defaultTimeout}}" "${PMJS}" \"$file\"
166168
exitCode="$?"
167169
;;
168170
"bash")
169-
bash "$file"
171+
eval timeout -s9 "${timeout:-${defaultTimeout}}" bash \"$file\"
170172
exitCode="$?"
171173
;;
172174
*)

0 commit comments

Comments
 (0)