libplugin: plugin_exit helper which flushes stdout.

We weren't actually getting the last log out; this does that.

We have to fix test_bitcoin_failure which now notices the BROKEN
log message.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: libplugin: Fatal error messages from plugin_exit() now logged in lightningd.
This commit is contained in:
Rusty Russell
2021-09-03 19:46:20 +09:30
committed by Christian Decker
parent 1d8aecb44f
commit 2063049559
3 changed files with 28 additions and 3 deletions

View File

@@ -164,6 +164,9 @@ struct command_result *command_param_failed(void);
/* Call this on fatal error. */
void NORETURN plugin_err(struct plugin *p, const char *fmt, ...);
/* Normal exit (makes sure to flush output!). */
void NORETURN plugin_exit(struct plugin *p, int exitcode);
/* This command is finished, here's a detailed error; @cmd cannot be
* NULL, data can be NULL; otherwise it must be a JSON object. */
struct command_result *WARN_UNUSED_RESULT