From 4c9bfa351a4576d6db4972d8c7d129d5e0e9fff8 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 3 Aug 2019 16:09:39 +0930 Subject: [PATCH] lightningd: handle --version before trying to move to lightning-dir. Otherwise it creates the lightning-dir. This can't be helped for --help (at least, if plugins are present), but --version simply prints and exits. Signed-off-by: Rusty Russell --- lightningd/options.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lightningd/options.c b/lightningd/options.c index 9b36b6696..a3272f08b 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -747,6 +747,9 @@ static void handle_minimal_config_opts(struct lightningd *ld, &ld->config_dir, "Set working directory. All other files are relative to this"); + /* Handle --version (and exit) here too: don't create lightning-dir for this */ + opt_register_version(); + opt_early_parse_incomplete(argc, argv, opt_log_stderr_exit); /* Now, reset and ignore those options from now on. */