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
This commit is contained in:
Wladimir J. van der Laan 2018-06-07 08:58:06 +02:00 committed by UdjinM6
parent 2c7c4bcc08
commit 62c1477638
No known key found for this signature in database
GPG Key ID: 83592BD1400D58D9

View File

@ -59,6 +59,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
@ -524,6 +536,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);