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 30, 2024
1 parent 9d09655 commit 6544749
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tools/bits-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,39 @@
SCRIPT_NAME='Bits info'
SCRIPT_VERSION='1.5.17'

my_func()
{
#return 0
#return 5
sleep 6
}

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 1>&2 'Still running'
else
wait "${_pid}" || return "${?}"
return '0'
fi
done

kill 1>&2 "${_pid}"
echo 1>&2 $?
return 124
}

my_func_timeout
echo "Return value: ${?}"

### CONFIGURATION ###

set -u 2> /dev/null || :
Expand Down

0 comments on commit 6544749

Please sign in to comment.