Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_node.py
Show First 20 Lines • Show All 730 Lines • ▼ Show 20 Lines | def send_cli(self, command=None, *args, **kwargs): | ||||
p_args = [self.binary, "-datadir=" + self.datadir] + self.options | p_args = [self.binary, "-datadir=" + self.datadir] + self.options | ||||
if named_args: | if named_args: | ||||
p_args += ["-named"] | p_args += ["-named"] | ||||
if command is not None: | if command is not None: | ||||
p_args += [command] | p_args += [command] | ||||
p_args += pos_args + named_args | p_args += pos_args + named_args | ||||
if self.emulator is not None: | if self.emulator is not None: | ||||
p_args = [self.emulator] + p_args | p_args = [self.emulator] + p_args | ||||
self.log.debug("Running bitcoin-cli command: {}".format(command)) | self.log.debug("Running bitcoin-cli {}".format(p_args[2:])) | ||||
process = subprocess.Popen(p_args, stdin=subprocess.PIPE, | process = subprocess.Popen(p_args, stdin=subprocess.PIPE, | ||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) | stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) | ||||
cli_stdout, cli_stderr = process.communicate(input=self.input) | cli_stdout, cli_stderr = process.communicate(input=self.input) | ||||
returncode = process.poll() | returncode = process.poll() | ||||
if returncode: | if returncode: | ||||
match = re.match( | match = re.match( | ||||
r'error code: ([-0-9]+)\nerror message:\n(.*)', cli_stderr) | r'error code: ([-0-9]+)\nerror message:\n(.*)', cli_stderr) | ||||
if match: | if match: | ||||
▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines |