Apply suggestions from code review

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
Brennan Kinney 2024-01-16 10:16:53 +13:00 committed by GitHub
parent 4e732d2a55
commit 7c322bd8a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -158,7 +158,7 @@ function _should_restart_when_killed() {
# NOTE: The process name from `pkill --echo` does not always match the equivalent processs name from `pgrep --list-full`.
# The oldest process returned (if multiple) should be the top-level process launched by supervisord,
# the PID will verify the target process was killed correctly:
local PID=$(docker exec "${CONTAINER_NAME}" pgrep --full --oldest "${PROCESS}")
local PID=$(_exec_in_container pgrep --full --oldest "${PROCESS}")
_run_in_container pkill --echo --full "${PROCESS}"
assert_output --partial "killed (pid ${PID})"
assert_success
@ -185,7 +185,7 @@ function _check_if_process_is_running() {
# `--list-full` provides information for matching against (full process path)
# `--full` allows matching the process against the full path (required if a process is not the exec command, such as started by python3 command without a shebang)
# `--oldest` should select the parent process when there are multiple results, typically the command defined in `supervisor-app.conf`
local IS_RUNNING=$(docker exec "${CONTAINER_NAME}" pgrep --full --list-full "${MIN_SECS_RUNNING[@]}" --oldest "${PROCESS}")
local IS_RUNNING=$(_exec_in_container pgrep --full --list-full "${MIN_SECS_RUNNING[@]}" --oldest "${PROCESS}")
# When no matches are found, nothing is returned. Provide something we can assert on (helpful for debugging):
if [[ ! ${IS_RUNNING} =~ ${PROCESS} ]]; then