diff options
author | Andrei Pavel <andrei@isc.org> | 2020-12-11 18:02:04 +0100 |
---|---|---|
committer | Andrei Pavel <andrei@isc.org> | 2020-12-14 11:08:39 +0100 |
commit | 001fe64e386230766a836eeb4222ab9c3953e6b7 (patch) | |
tree | d472b17cae89d85f955831cad7c3b374dbc62ef7 | |
parent | [#1574] fixes in src/bin/shell/tests (diff) | |
download | kea-001fe64e386230766a836eeb4222ab9c3953e6b7.tar.xz kea-001fe64e386230766a836eeb4222ab9c3953e6b7.zip |
[#1574] add 15 char limit for pgrep as comment
-rw-r--r-- | src/lib/testutils/dhcp_test_lib.sh.in | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/testutils/dhcp_test_lib.sh.in b/src/lib/testutils/dhcp_test_lib.sh.in index 673924291d..31c3c7a934 100644 --- a/src/lib/testutils/dhcp_test_lib.sh.in +++ b/src/lib/testutils/dhcp_test_lib.sh.in @@ -441,6 +441,11 @@ wait_for_process_to_die() { # It uses 'pgrep' to obtain pids of those processes. # This function should be used when identifying process by # the value in its PID file is not relevant. +# +# Linux limitation for pgrep: The process name used for matching is +# limited to the 15 characters. If you call this with long process +# names, add this before pgrep: +# proc_name=$(printf '%s' "${proc_name}" | cut -c1-15) kill_processes_by_name() { local proc_name=${1} # Process name if [ -z "${proc_name}" ]; then @@ -449,8 +454,7 @@ kill_processes_by_name() { fi # Obtain PIDs of running processes. local pids - truncated_proc_name=$(printf '%s' "${proc_name}" | cut -c1-15) - pids=$(pgrep "${truncated_proc_name}" || true) + pids=$(pgrep "${proc_name}" || true) # For each PID found, send kill signal. for pid in ${pids} do |