mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
lightningd: use env var not cmdline to suppress backtrace.
We now set it up *before* parsing cmdline, so this is more convenient. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
ed9e580358
commit
6b9c525f35
@@ -34,10 +34,6 @@
|
||||
|
||||
char *bitcoin_datadir;
|
||||
|
||||
#if DEVELOPER
|
||||
bool dev_no_backtrace;
|
||||
#endif
|
||||
|
||||
struct backtrace_state *backtrace_state;
|
||||
|
||||
void db_resolve_invoice(struct lightningd *ld,
|
||||
@@ -245,7 +241,8 @@ int main(int argc, char *argv[])
|
||||
err_set_progname(argv[0]);
|
||||
|
||||
#if DEVELOPER
|
||||
if (!dev_no_backtrace)
|
||||
/* Suppresses backtrace (breaks valgrind) */
|
||||
if (!getenv("LIGHTNINGD_DEV_NO_BACKTRACE"))
|
||||
#endif
|
||||
backtrace_state = backtrace_create_state(argv[0], 0, NULL, NULL);
|
||||
|
||||
|
||||
@@ -175,7 +175,4 @@ struct chainparams *get_chainparams(const struct lightningd *ld);
|
||||
/* State for performing backtraces. */
|
||||
struct backtrace_state *backtrace_state;
|
||||
|
||||
#if DEVELOPER
|
||||
extern bool dev_no_backtrace;
|
||||
#endif
|
||||
#endif /* LIGHTNING_LIGHTNINGD_LIGHTNINGD_H */
|
||||
|
||||
@@ -298,9 +298,6 @@ static void dev_register_opts(struct lightningd *ld)
|
||||
NULL, ld, "File containing disconnection points");
|
||||
opt_register_arg("--dev-hsm-seed=<seed>", opt_set_hsm_seed,
|
||||
NULL, ld, "Hex-encoded seed for HSM");
|
||||
opt_register_noarg("--dev-no-backtrace", opt_set_bool,
|
||||
&dev_no_backtrace,
|
||||
"Disable backtrace (crashes under valgrind)");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class NodeFactory(object):
|
||||
if DEVELOPER:
|
||||
daemon.cmd_line.append("--dev-fail-on-subdaemon-fail")
|
||||
if VALGRIND:
|
||||
daemon.cmd_line.append("--dev-no-backtrace")
|
||||
daemon.env["LIGHTNINGD_DEV_NO_BACKTRACE"] = "1"
|
||||
opts = [] if options is None else options
|
||||
for opt in opts:
|
||||
daemon.cmd_line.append(opt)
|
||||
|
||||
@@ -44,6 +44,7 @@ class TailableProc(object):
|
||||
self.logs = []
|
||||
self.logs_cond = threading.Condition(threading.RLock())
|
||||
self.cmd_line = None
|
||||
self.env = os.environ
|
||||
self.running = False
|
||||
self.proc = None
|
||||
self.outputDir = outputDir
|
||||
@@ -53,7 +54,7 @@ class TailableProc(object):
|
||||
"""Start the underlying process and start monitoring it.
|
||||
"""
|
||||
logging.debug("Starting '%s'", " ".join(self.cmd_line))
|
||||
self.proc = subprocess.Popen(self.cmd_line, stdout=subprocess.PIPE)
|
||||
self.proc = subprocess.Popen(self.cmd_line, stdout=subprocess.PIPE, env=self.env)
|
||||
self.thread = threading.Thread(target=self.tail)
|
||||
self.thread.daemon = True
|
||||
self.thread.start()
|
||||
|
||||
Reference in New Issue
Block a user