Browse Source

lightningd: Defer creating the PID until we actually want to start

This was causing `--help` to fail if we already had a `lightningd` running
with the same `--lightning-dir`.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
pull/2938/head
Christian Decker 5 years ago
committed by ZmnSCPxj, ZmnSCPxj jxPCSmnZ
parent
commit
820b52207e
  1. 8
      lightningd/lightningd.c

8
lightningd/lightningd.c

@ -672,10 +672,6 @@ int main(int argc, char *argv[])
* say --daemonize. */
handle_early_opts(ld, argc, argv);
/*~ Now create the PID file: this errors out if there's already a
* daemon running, so we call before doing almost anything else. */
pidfile_create(ld);
/*~ Initialize all the plugins we just registered, so they can
* do their thing and tell us about themselves (including
* options registration). */
@ -684,6 +680,10 @@ int main(int argc, char *argv[])
/*~ Handle options and config; move to .lightningd (--lightning-dir) */
handle_opts(ld, argc, argv);
/*~ Now create the PID file: this errors out if there's already a
* daemon running, so we call before doing almost anything else. */
pidfile_create(ld);
/*~ Make sure we can reach the subdaemons, and versions match. */
test_subdaemons(ld);

Loading…
Cancel
Save