When calling source-file directly (unlike at server startup), in order not to clobber multiple source-file commands from the initial config file load, ensure we gather all errors across all files before displaying them. --- cfg.c | 5 +++++ cmd-source-file.c | 3 ++- tmux.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/cfg.c b/cfg.c index 3b4c748..fe2b368 100644 --- a/cfg.c +++ b/cfg.c @@ -36,6 +36,7 @@ void printflike2 cfg_error(struct cmd_ctx *, const char *, ...); char *cfg_cause; int cfg_finished; +int cfg_references; /* ARGSUSED */ void printflike2 @@ -88,6 +89,8 @@ load_cfg(const char *path, struct cmd_ctx *ctxin, struct causelist *causes) } n = 0; + cfg_references++; + line = NULL; retval = CMD_RETURN_NORMAL; while ((buf = fgetln(f, &len))) { @@ -170,6 +173,8 @@ load_cfg(const char *path, struct cmd_ctx *ctxin, struct causelist *causes) } fclose(f); + cfg_references--; + return (retval); } diff --git a/cmd-source-file.c b/cmd-source-file.c index 775a0cc..e34828a 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -53,7 +53,8 @@ cmd_source_file_exec(struct cmd *self, struct cmd_ctx *ctx) * error condition. Any errors from parsing a configuration file at * startup will be handled for us by the server. */ - if (ctx->cmdclient == NULL) + if (cfg_references > 0 || + (ctx->curclient == NULL && ctx->cmdclient == NULL)) return (retval); /* We were called from the command-line in which case print the errors diff --git a/tmux.h b/tmux.h index faab3fe..a0fda8b 100644 --- a/tmux.h +++ b/tmux.h @@ -1513,6 +1513,7 @@ __dead void shell_exec(const char *, const char *); /* cfg.c */ extern int cfg_finished; +extern int cfg_references; extern struct causelist cfg_causes; void printflike2 cfg_add_cause(struct causelist *, const char *, ...); int load_cfg(const char *, struct cmd_ctx *, struct causelist *); -- 1.7.11.4 ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users