mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
test: use pgrep for better compatibility
pidof is not available on BSD system, while pgrep is present on BSD, Linux and macOS
This commit is contained in:
parent
80fd474e40
commit
8cf9d15b82
1 changed files with 4 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue