From b61b663895f16d9f559a14c408c225062254a57b Mon Sep 17 00:00:00 2001 From: Yossi Gottlieb Date: Sun, 30 Aug 2020 12:23:47 +0300 Subject: [PATCH] Fix oom-score-adj on older distros. (#7724) Don't assume `ps` handles `-h` to display output without headers and manually trim headers line from output. --- tests/unit/oom-score-adj.tcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/oom-score-adj.tcl b/tests/unit/oom-score-adj.tcl index 894a70fb2..993004602 100644 --- a/tests/unit/oom-score-adj.tcl +++ b/tests/unit/oom-score-adj.tcl @@ -16,8 +16,8 @@ if {$system_name eq {linux}} { proc get_child_pid {} { set pid [srv 0 pid] - set fd [open "|ps --ppid $pid -o pid -h" "r"] - set child_pid [string trim [read $fd]] + set fd [open "|ps --ppid $pid -o pid" "r"] + set child_pid [string trim [lindex [split [read $fd] \n] 1]] close $fd return $child_pid