Details
-
Bug
-
Resolution: Done
-
Major - P3
-
3.2.12, 3.4.2, 3.5.3
-
Fully Compatible
-
ALL
-
v3.4, v3.2, v3.0
-
TIG 2017-04-17
-
0
Description
The "kill processes" function has a coding error:
pgrep_list_full=$(pgrep -f --list-full ".*" 2>&1 > /dev/null)
|
if [ -z "$pgrep_list_full" ]; then
|
...
|
fi
|
Since stdout & stderr are directed to /dev/null, this will always be true.
Similarly, this test is also flawed:
grep=grep
|
grep_extended=$(echo "a" | $grep -E "(a)" 2>&1 > /dev/null)
|
if [ ! -z "$grep_extended" ]; then
|
...
|
fi
|
The fix is to just direct stderr to /dev/null:
pgrep_list_full=$(pgrep -f --list-full ".*" 2> /dev/null)
|
if [ ! -z "$pgrep_list_full" ]; then
|
...
|
fi
|
...
|
grep_extended=$(echo "a" | $grep -E "(a)" 2> /dev/null)
|
...
|
An alternate fix would be to test for $?