Applied, thanks. On Mon, Sep 23, 2013 at 03:02:55PM -0500, Chris Johnsen wrote: > With tmux 1.7, when a client executes a 'source-file' command that > includes a 'new-session' or an 'attach-session' command, the client will > end up attached. > > After the cmdq revamp, such a client always exits after 'source-file' > finishes. The "attaching commands" set cmdq->client_exit to 0, but, when > run under 'source-file' (or 'if-shell'), this only affects the "child" > cmdq that is used by these commands; the main cmdq created for the > client's direct commands still has client_exit at its default of 1, so > the client is told to exit shortly after the source-file command > finishes. > > Introduce a new "unset" value to cmdq->client_exit so that > a client_exit value that is explicitly established in a "child" cmdq > ('source-file' or 'if-shell') can be distinguished and passed along > to its "parent" cmdq (i.e. eventually up to the client's main cmdq). > > --- > The following shell command reproduces the issue: > > ./tmux -L other new -ds test \; if true 'attach -t test' > > After the cmdq introduction the client exits immediately. In older > versions (and after this patch) the client stays attached to the > "test" session. > > The same thing happens if you replace the "if-shell" command with > a "source-file" that does the attach; if-shell is just easier to use > in a shell one-liner since it does not need a separate file. > --- > cmd-if-shell.c | 3 +++ > cmd-queue.c | 4 ++-- > cmd-source-file.c | 3 +++ > 3 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/cmd-if-shell.c b/cmd-if-shell.c > index d1cbd7f..42b8376 100644 > --- a/cmd-if-shell.c > +++ b/cmd-if-shell.c > @@ -148,6 +148,9 @@ cmd_if_shell_done(struct cmd_q *cmdq1) > struct cmd_if_shell_data *cdata = cmdq1->data; > struct cmd_q *cmdq = cdata->cmdq; > > + if (cmdq1->client_exit >= 0) > + cmdq->client_exit = cmdq1->client_exit; > + > if (!cmdq_free(cmdq) && !cdata->bflag) > cmdq_continue(cmdq); > > diff --git a/cmd-queue.c b/cmd-queue.c > index 671f1e9..7c651bf 100644 > --- a/cmd-queue.c > +++ b/cmd-queue.c > @@ -35,7 +35,7 @@ cmdq_new(struct client *c) > cmdq->dead = 0; > > cmdq->client = c; > - cmdq->client_exit = 0; > + cmdq->client_exit = -1; > > TAILQ_INIT(&cmdq->queue); > cmdq->item = NULL; > @@ -256,7 +256,7 @@ cmdq_continue(struct cmd_q *cmdq) > } while (cmdq->item != NULL); > > empty: > - if (cmdq->client_exit) > + if (cmdq->client_exit > 0) > cmdq->client->flags |= CLIENT_EXIT; > if (cmdq->emptyfn != NULL) > cmdq->emptyfn(cmdq); /* may free cmdq */ > diff --git a/cmd-source-file.c b/cmd-source-file.c > index 45a3a39..48dd638 100644 > --- a/cmd-source-file.c > +++ b/cmd-source-file.c > @@ -96,6 +96,9 @@ cmd_source_file_done(struct cmd_q *cmdq1) > { > struct cmd_q *cmdq = cmdq1->data; > > + if (cmdq1->client_exit >= 0) > + cmdq->client_exit = cmdq1->client_exit; > + > cmdq_free(cmdq1); > > cfg_references--; > -- > 1.8.4 > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk > _______________________________________________ > tmux-users mailing list > tmux-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users