Skip to content

Commit

Permalink
Update bits-info.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ale5000-git authored Oct 28, 2024
1 parent 6986266 commit 74c38fe
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tools/bits-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,38 @@ SCRIPT_VERSION='1.5.13'

### CONFIGURATION ###

my_func()
{
sleep 120
}

my_func_timeout()
{
local _sec_limit _pid
_sec_limit=3

my_func &
_pid="${!}"

while test "$((_sec_limit = _sec_limit - 1))" -ge 0; do
sleep 1
if kill 2> /dev/null -0 "${_pid}"; then
echo 'Still running'
else
wait "${_pid}" || return "${?}"
return '0'
fi
done

kill "${_pid}"
echo "Kill: $?"
return 124
}

my_func_timeout
echo "Return value: ${?}"
exit 0

set -u 2> /dev/null || :
# shellcheck disable=SC3040 # Ignore: In POSIX sh, set option pipefail is undefined
case "$(set 2> /dev/null -o || set || :)" in *'pipefail'*) set -o pipefail || printf 1>&2 '%s\n' 'Failed: pipefail' ;; *) ;; esac
Expand Down

0 comments on commit 74c38fe

Please sign in to comment.