port: BSD cut doesn't support '\0' as a delimiter
[lttng-tools.git] / tests / utils / utils.sh
index b33a264c2597fd4ca06b6fa08fcf3872ec9a897f..ea354cf62fc4236f4201e834e0353d0317eb1210 100644 (file)
@@ -148,7 +148,7 @@ function lttng_pgrep ()
 
        while IFS= read -r pid ; do
                # /proc/pid/cmdline is null separated.
-               if full_command_no_argument=$(cut -d '' -f 1 2>/dev/null < /proc/"$pid"/cmdline); then
+               if full_command_no_argument=$(tr '\0' '\n' < /proc/"$pid"/cmdline 2>/dev/null | head -n1); then
                        command_basename=$(basename "$full_command_no_argument")
                        if grep -q "$pattern" <<< "$command_basename"; then
                                echo "$pid"
This page took 0.025132 seconds and 4 git commands to generate.