mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 11:59:16 +01:00
lightningd: pass --developer down to plugins, subdaemons when it set.
They might need to know this before they do anything, so cmdline seems most natural. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
64ab7c0c1d
commit
67a391f8d0
3 changed files with 11 additions and 4 deletions
|
@ -1823,10 +1823,13 @@ const char *plugin_send_getmanifest(struct plugin *p, const char *cmd_id)
|
|||
&& strends(p->cmd, p->plugins->ld->dev_debug_subprocess))
|
||||
debug = true;
|
||||
#endif
|
||||
cmd = tal_arrz(tmpctx, char *, 2 + debug);
|
||||
cmd = tal_arr(tmpctx, char *, 1);
|
||||
cmd[0] = p->cmd;
|
||||
if (debug)
|
||||
cmd[1] = "--debugger";
|
||||
tal_arr_expand(&cmd, "--debugger");
|
||||
if (p->plugins->ld->developer)
|
||||
tal_arr_expand(&cmd, "--developer");
|
||||
tal_arr_expand(&cmd, NULL);
|
||||
p->pid = pipecmdarr(&stdinfd, &stdoutfd, &pipecmd_preserve, cmd);
|
||||
if (p->pid == -1)
|
||||
return tal_fmt(p, "opening pipe: %s", strerror(errno));
|
||||
|
|
|
@ -203,6 +203,7 @@ static int subd(const char *path, const char *name,
|
|||
const char *debug_subdaemon,
|
||||
int *msgfd,
|
||||
bool io_logging,
|
||||
bool developer,
|
||||
va_list *ap)
|
||||
{
|
||||
int childmsg[2], execfail[2];
|
||||
|
@ -225,7 +226,7 @@ static int subd(const char *path, const char *name,
|
|||
|
||||
if (childpid == 0) {
|
||||
size_t num_args;
|
||||
char *args[] = { NULL, NULL, NULL, NULL };
|
||||
char *args[] = { NULL, NULL, NULL, NULL, NULL };
|
||||
int **fds = tal_arr(tmpctx, int *, 3);
|
||||
int stdoutfd = STDOUT_FILENO, stderrfd = STDERR_FILENO;
|
||||
|
||||
|
@ -260,6 +261,8 @@ static int subd(const char *path, const char *name,
|
|||
if (debug_subdaemon && strends(name, debug_subdaemon))
|
||||
args[num_args++] = "--debugger";
|
||||
#endif
|
||||
if (developer)
|
||||
args[num_args++] = "--developer";
|
||||
execv(args[0], args);
|
||||
|
||||
child_errno_fail:
|
||||
|
@ -743,6 +746,7 @@ static struct subd *new_subd(const tal_t *ctx,
|
|||
/* We only turn on subdaemon io logging if we're going
|
||||
* to print it: too stressful otherwise! */
|
||||
log_has_io_logging(sd->log),
|
||||
ld->developer,
|
||||
ap);
|
||||
if (sd->pid == (pid_t)-1) {
|
||||
log_unusual(ld->log, "subd %s failed: %s",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh
|
||||
|
||||
# If this file exists, we send that message back, then sleep.
|
||||
if [ $# = 0 ] && [ -f openingd-version ]; then
|
||||
if [ "$1" != "--version" ] && [ -f openingd-version ]; then
|
||||
# lightningd expects us to write to stdin!
|
||||
cat openingd-version >&0
|
||||
sleep 10
|
||||
|
|
Loading…
Add table
Reference in a new issue