aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-04-09 10:46:36 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-04-09 10:46:44 -0400
commitf9f6c11a74222014f8885476301d962a5735db0d (patch)
tree1484eca7455b811ebc31e385b815de62f9bfca71 /test
parentf3ecf3025f82f84d42ec463990ff787647cc7bf5 (diff)
parent90bce24576a52c9f3aacfa59f44443eb5328dda0 (diff)
Merge #15771: qa: Prevent concurrency issues reading .cookie file
90bce24576 qa: Prevent concurrency issues reading .cookie file (João Barbosa) Pull request description: Hopefully fixes #15733. ACKs for commit 90bce2: Tree-SHA512: 4db06a63bb57e8ae56a4eab9d352a9a8d66dd7425cf491ca5f9e1ec5e60e61cb5af9eedbd32a0a9f9bdd770d767adf499eed05dd03221686eb357f6417441b61
Diffstat (limited to 'test')
-rw-r--r--test/functional/test_framework/util.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index f771a37b99..190301b215 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -323,12 +323,14 @@ def get_auth_cookie(datadir):
if line.startswith("rpcpassword="):
assert password is None # Ensure that there is only one rpcpassword line
password = line.split("=")[1].strip("\n")
- if os.path.isfile(os.path.join(datadir, "regtest", ".cookie")) and os.access(os.path.join(datadir, "regtest", ".cookie"), os.R_OK):
+ try:
with open(os.path.join(datadir, "regtest", ".cookie"), 'r', encoding="ascii") as f:
userpass = f.read()
split_userpass = userpass.split(':')
user = split_userpass[0]
password = split_userpass[1]
+ except OSError:
+ pass
if user is None or password is None:
raise ValueError("No RPC credentials")
return user, password