@@ -61,7 +61,7 @@ class TestNode():
61
61
To make things easier for the test writer, any unrecognised messages will
62
62
be dispatched to the RPC connection."""
63
63
64
- def __init__ (self , i , datadir , * , rpchost , timewait , bitcoind , bitcoin_cli , mocktime , coverage_dir , extra_conf = None , extra_args = None , use_cli = False , start_perf = False ):
64
+ def __init__ (self , i , datadir , * , rpchost , timewait , bitcoind , bitcoin_cli , mocktime , coverage_dir , cwd , extra_conf = None , extra_args = None , use_cli = False , start_perf = False ):
65
65
"""
66
66
Kwargs:
67
67
start_perf (bool): If True, begin profiling the node with `perf` as soon as
@@ -76,6 +76,7 @@ def __init__(self, i, datadir, *, rpchost, timewait, bitcoind, bitcoin_cli, mock
76
76
self .rpc_timeout = timewait
77
77
self .binary = bitcoind
78
78
self .coverage_dir = coverage_dir
79
+ self .cwd = cwd
79
80
if extra_conf is not None :
80
81
append_config (datadir , extra_conf )
81
82
# Most callers will just need to add extra args to the standard list below.
@@ -171,7 +172,7 @@ def __getattr__(self, name):
171
172
assert self .rpc_connected and self .rpc is not None , self ._node_msg ("Error: no RPC connection" )
172
173
return getattr (self .rpc , name )
173
174
174
- def start (self , extra_args = None , * , stdout = None , stderr = None , ** kwargs ):
175
+ def start (self , extra_args = None , * , cwd = None , stdout = None , stderr = None , ** kwargs ):
175
176
"""Start the node."""
176
177
if extra_args is None :
177
178
extra_args = self .extra_args
@@ -184,6 +185,9 @@ def start(self, extra_args=None, *, stdout=None, stderr=None, **kwargs):
184
185
self .stderr = stderr
185
186
self .stdout = stdout
186
187
188
+ if cwd is None :
189
+ cwd = self .cwd
190
+
187
191
# Delete any existing cookie file -- if such a file exists (eg due to
188
192
# unclean shutdown), it will get overwritten anyway by bitcoind, and
189
193
# potentially interfere with our attempt to authenticate
@@ -192,7 +196,7 @@ def start(self, extra_args=None, *, stdout=None, stderr=None, **kwargs):
192
196
# add environment variable LIBC_FATAL_STDERR_=1 so that libc errors are written to stderr and not the terminal
193
197
subp_env = dict (os .environ , LIBC_FATAL_STDERR_ = "1" )
194
198
195
- self .process = subprocess .Popen (self .args + extra_args , env = subp_env , stdout = stdout , stderr = stderr , ** kwargs )
199
+ self .process = subprocess .Popen (self .args + extra_args , env = subp_env , stdout = stdout , stderr = stderr , cwd = cwd , ** kwargs )
196
200
197
201
self .running = True
198
202
self .log .debug ("bitcoind started, waiting for RPC to come up" )
0 commit comments