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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-08-03 16:09:39 +09:30
parent b460590278
commit 4c9bfa351a

View File

@@ -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. */