test: fix bitcoind already running warnings on macOS

On macOS, pidof installed via brew returns b'' rather than None.
Account for this, to remove spurious warnings from the test_runner.
pull/764/head
fanquake 5 years ago
parent b90dad5143
commit 1c23ea5fe6
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

@ -364,9 +364,10 @@ def main():
def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, runs_ci, use_term_control): def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, runs_ci, use_term_control):
args = args or [] args = args or []
# Warn if bitcoind is already running (unix only) # Warn if bitcoind is already running
# pidof might fail or return an empty string if bitcoind is not running
try: try:
if subprocess.check_output(["pidof", "bitcoind"]) is not None: if subprocess.check_output(["pidof", "bitcoind"]) not in [b'']:
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])) 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, subprocess.SubprocessError):
pass pass

Loading…
Cancel
Save