aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-02-26 13:19:09 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-02-26 13:19:46 +0100
commit3480bf7c650bb14a31020c3ef33e76edea650e13 (patch)
treee023e658248a11a45fd3c10960275b5b3747028e
parent34b9ea7db1831a1c9bde58222f7cd53053e784c4 (diff)
parenta7199038042a79d24bce7e94a3984ad3e05be184 (diff)
downloadbitcoin-3480bf7c650bb14a31020c3ef33e76edea650e13.tar.xz
Merge pull request #3736
a719903 Fix bitcoin-cli exit status code (Cozz Lovan)
-rw-r--r--src/bitcoin-cli.cpp11
-rw-r--r--src/rpcclient.cpp2
2 files changed, 8 insertions, 5 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 04b75e7f1c..51a746f84f 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -6,6 +6,7 @@
#include "util.h"
#include "init.h"
#include "rpcclient.h"
+#include "rpcprotocol.h"
#include "ui_interface.h" /* for _(...) */
#include "chainparams.h"
@@ -55,23 +56,25 @@ int main(int argc, char* argv[])
try
{
if(!AppInitRPC(argc, argv))
- return 1;
+ return abs(RPC_MISC_ERROR);
}
catch (std::exception& e) {
PrintExceptionContinue(&e, "AppInitRPC()");
+ return abs(RPC_MISC_ERROR);
} catch (...) {
PrintExceptionContinue(NULL, "AppInitRPC()");
+ return abs(RPC_MISC_ERROR);
}
+ int ret = abs(RPC_MISC_ERROR);
try
{
- if(!CommandLineRPC(argc, argv))
- return 1;
+ ret = CommandLineRPC(argc, argv);
}
catch (std::exception& e) {
PrintExceptionContinue(&e, "CommandLineRPC()");
} catch (...) {
PrintExceptionContinue(NULL, "CommandLineRPC()");
}
- return 0;
+ return ret;
}
diff --git a/src/rpcclient.cpp b/src/rpcclient.cpp
index c404ac274b..0d1746b8ca 100644
--- a/src/rpcclient.cpp
+++ b/src/rpcclient.cpp
@@ -233,7 +233,7 @@ int CommandLineRPC(int argc, char *argv[])
}
catch (std::exception& e) {
strPrint = string("error: ") + e.what();
- nRet = 87;
+ nRet = abs(RPC_MISC_ERROR);
}
catch (...) {
PrintException(NULL, "CommandLineRPC()");