Skip to content

Commit 57b09e4

Browse files
committed
pkill tests: Fix pkill usage in the pkill -x test
The target process name(s) mark the beginning of the command's positional parameters, so the -P filter wasn't getting applied as intended. As a result, the second "pkill -x sleep -P $$" would kill all sleep(1) processes in the system, which can cause problems when running tests in parallel. MFC after: 2 weeks
1 parent cf6a780 commit 57b09e4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bin/pkill/tests/pkill-x_test.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ sleep=$(pwd)/sleep.txt
99
ln -sf /bin/sleep $sleep
1010
$sleep 5 &
1111
sleep 0.3
12-
pkill -x slee -P $$
12+
pkill -P $$ -x slee
1313
if [ $? -ne 0 ]; then
1414
echo "ok 1 - $name"
1515
else
1616
echo "not ok 1 - $name"
1717
fi
18-
pkill -x sleep -P $$
18+
pkill -P $$ -x sleep
1919
if [ $? -eq 0 ]; then
2020
echo "ok 2 - $name"
2121
else
@@ -28,13 +28,13 @@ sleep=$(pwd)/sleep.txt
2828
ln -sf /bin/sleep $sleep
2929
$sleep 5 &
3030
sleep 0.3
31-
pkill -x -f "$sleep " -P $$
31+
pkill -P $$ -x -f "$sleep "
3232
if [ $? -ne 0 ]; then
3333
echo "ok 3 - $name"
3434
else
3535
echo "not ok 3 - $name"
3636
fi
37-
pkill -x -f "$sleep 5" -P $$
37+
pkill -P $$ -x -f "$sleep 5"
3838
if [ $? -eq 0 ]; then
3939
echo "ok 4 - $name"
4040
else

0 commit comments

Comments
 (0)