]>
git.ipfire.org Git - thirdparty/systemd.git/blob - travis-ci/managers/travis_wait.bash
1 # This was borrowed from https://github.com/travis-ci/travis-build/tree/master/lib/travis/build/bash
2 # to get around https://github.com/travis-ci/travis-ci/issues/9979. It should probably be removed
3 # as soon as Travis CI has started to provide an easy way to export the functions to bash scripts.
14 while [[ "${count}" -lt "${timeout}" ]]; do
15 count
="$((count + 1))"
16 echo -ne "Still running (${count} of ${timeout}): ${*}\\r"
20 echo -e "\\n${ANSI_RED}Timeout (${timeout} minutes) reached. Terminating \"${*}\"${ANSI_RESET}\\n"
27 if [[ "${timeout}" =~ ^
[0-9]+$
]]; then
34 local log_file
="travis_wait_${$}.log"
36 "${cmd[@]}" &>"${log_file}" &
39 travis_jigger
"${!}" "${timeout}" "${cmd[@]}" &
40 local jigger_pid
="${!}"
45 wait "${cmd_pid}" 2>/dev
/null
47 ps
-p"${jigger_pid}" &>/dev
/null
&& kill "${jigger_pid}"
51 if [[ "${result}" -eq 0 ]]; then
52 echo -e "\\n${ANSI_GREEN}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}"
54 echo -e "\\n${ANSI_RED}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}"
57 echo -e "\\n${ANSI_GREEN}Log:${ANSI_RESET}\\n"