diff --git a/libexec/shellspec-profiler.sh b/libexec/shellspec-profiler.sh index a24c0fde..fa08c924 100755 --- a/libexec/shellspec-profiler.sh +++ b/libexec/shellspec-profiler.sh @@ -4,7 +4,7 @@ set -eu handler() { - eval "counter${index}=$counter && index=$(($index + 1))" + eval "counter${index}=$counter index=$(($index + 1)) cmd=:" } terminate() { diff --git a/libexec/shellspec-runner.sh b/libexec/shellspec-runner.sh index 2dd06d9d..5e5bbed5 100755 --- a/libexec/shellspec-runner.sh +++ b/libexec/shellspec-runner.sh @@ -19,9 +19,9 @@ start_profiler() { stop_profiler() { [ "$SHELLSPEC_PROFILER_PID" ] || return 0 - signal -TERM "$SHELLSPEC_PROFILER_PID" 2>/dev/null ||: + profiler_pid=$SHELLSPEC_PROFILER_PID && SHELLSPEC_PROFILER_PID='' + signal -TERM "$profiler_pid" 2>/dev/null ||: sleep_wait [ ! -e "$SHELLSPEC_TMPBASE/profiler.done" ] ||: - SHELLSPEC_PROFILER_PID='' } cleanup() {