aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIvan Metlushko <metlushko@gmail.com>2020-06-24 09:08:41 +0700
committerIvan Metlushko <metlushko@gmail.com>2020-06-24 09:29:50 +0700
commit8cf9d15b823d91d2a74fc83832fccca2219342c9 (patch)
tree410b4dc14e83a687dbe820550dd1a61bcb911ea6 /test
parent80fd474e402bb003c3a427f1997eb649e69138ba (diff)
test: use pgrep for better compatibility
pidof is not available on BSD system, while pgrep is present on BSD, Linux and macOS
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/test_runner.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index 41f9bde183..2fa48006f4 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -396,11 +396,12 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
args = args or []
# Warn if bitcoind is already running
- # pidof might fail or return an empty string if bitcoind is not running
try:
- if subprocess.check_output(["pidof", "bitcoind"]) not in [b'']:
+ # pgrep exits with code zero when one or more matching processes found
+ if subprocess.run(["pgrep", "-x", "bitcoind"], stdout=subprocess.DEVNULL).returncode == 0:
print("%sWARNING!%s There is already a bitcoind process running on this system. Tests may fail unexpectedly due to resource contention!" % (BOLD[1], BOLD[0]))
- except (OSError, subprocess.SubprocessError):
+ except OSError:
+ # pgrep not supported
pass
# Warn if there is a cache directory