diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-06-07 08:58:06 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-06-07 08:59:25 +0200 |
commit | e1f8dce9939a3754555ecd3017f7160a0328c1e6 (patch) | |
tree | 145446520715cdbee99b452a04886705068a174c /src | |
parent | 5779dc4f76ad8a79d5e1f229a64beb5d7b8d7c84 (diff) | |
parent | 0231ef6c6d4f45edffda4ac3bce2048f9c8a8c00 (diff) |
Merge #13394: cli: Ignore libevent warnings
0231ef6c6d4f45edffda4ac3bce2048f9c8a8c00 cli: Ignore libevent warnings (Cory Fields)
Pull request description:
Should fix rpc tests that fail due to an unclean stderr.
Untested as I'm not seeing these warnings. @promag mind seeing if this fixes your problem?
Tree-SHA512: fba5ae3f239b515e93e19f9c3eca659eb7fb21f1b1fec25b68285695bfd1ecbdcd9b2235543689aaf97bff85cbb762840f65365a67e791314e9a6b8db2c9e246
Diffstat (limited to 'src')
-rw-r--r-- | src/bitcoin-cli.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index be5ce14480..b332b5e581 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -56,6 +56,18 @@ static void SetupCliArgs() gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN); } +/** libevent event log callback */ +static void libevent_log_cb(int severity, const char *msg) +{ +#ifndef EVENT_LOG_ERR // EVENT_LOG_ERR was added in 2.0.19; but before then _EVENT_LOG_ERR existed. +# define EVENT_LOG_ERR _EVENT_LOG_ERR +#endif + // Ignore everything other than errors + if (severity >= EVENT_LOG_ERR) { + throw std::runtime_error(strprintf("libevent error: %s", msg)); + } +} + ////////////////////////////////////////////////////////////////////////////// // // Start @@ -506,6 +518,7 @@ int main(int argc, char* argv[]) fprintf(stderr, "Error: Initializing networking failed\n"); return EXIT_FAILURE; } + event_set_log_callback(&libevent_log_cb); try { int ret = AppInitRPC(argc, argv); |