aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2017-08-24 18:35:06 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2017-09-07 00:35:28 +0100
commit769684132985cd67cbe8c7629a917aba6a333688 (patch)
tree1b06c8376be8b76176de43c7c05167a418a99dfe /src/bitcoin-cli.cpp
parent66a5b419eff57588f674ef7f409c389b71bebb22 (diff)
Fix style in -stdin and -stdinrpcpass handling
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r--src/bitcoin-cli.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index fca6083ea8..3c94c99b3e 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -296,19 +296,22 @@ int CommandLineRPC(int argc, char *argv[])
}
std::string rpcPass;
if (gArgs.GetBoolArg("-stdinrpcpass", false)) {
- if(!std::getline(std::cin,rpcPass))
+ if (!std::getline(std::cin, rpcPass)) {
throw std::runtime_error("-stdinrpcpass specified but failed to read from standard input");
+ }
gArgs.ForceSetArg("-rpcpassword", rpcPass);
}
std::vector<std::string> args = std::vector<std::string>(&argv[1], &argv[argc]);
if (gArgs.GetBoolArg("-stdin", false)) {
// Read one arg per line from stdin and append
std::string line;
- while (std::getline(std::cin,line))
+ while (std::getline(std::cin, line)) {
args.push_back(line);
+ }
}
- if (args.size() < 1)
+ if (args.size() < 1) {
throw std::runtime_error("too few parameters (need at least command)");
+ }
std::string strMethod = args[0];
args.erase(args.begin()); // Remove trailing method name from arguments vector