diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-07-01 05:06:11 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-07-01 05:06:11 +0000 |
commit | 07af4ce499cd5c24d334aaee65fff7855966ef51 (patch) | |
tree | 3c4ef3649b93e198fbfb330695a31c4a5ddb36c9 | |
parent | ce2dc2a66af7ae9b92ec747fa7e5cbd0b78e0377 (diff) | |
download | rtmux-07af4ce499cd5c24d334aaee65fff7855966ef51.tar.gz rtmux-07af4ce499cd5c24d334aaee65fff7855966ef51.tar.bz2 rtmux-07af4ce499cd5c24d334aaee65fff7855966ef51.zip |
Fill in $TMUX.
-rw-r--r-- | cmd-respawn-window.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c index e13e179e..e79c673e 100644 --- a/cmd-respawn-window.c +++ b/cmd-respawn-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-respawn-window.c,v 1.3 2008-06-30 19:11:33 nicm Exp $ */ +/* $Id: cmd-respawn-window.c,v 1.4 2008-07-01 05:06:11 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -18,6 +18,8 @@ #include <sys/types.h> +#include <unistd.h> + #include "tmux.h" /* @@ -45,7 +47,9 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx) struct cmd_target_data *data = self->data; struct winlink *wl; struct session *s; - const char *env[] = { "TERM=screen", NULL }; + const char *env[] = { NULL /* TMUX= */, "TERM=screen", NULL }; + char buf[256]; + u_int i; if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL) return; @@ -55,6 +59,11 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_ctx *ctx) return; } + if (session_index(s, &i) != 0) + fatalx("session not found"); + xsnprintf(buf, sizeof buf, "TMUX=%ld,%u", (long) getpid(), i); + env[0] = buf; + if (window_spawn(wl->window, data->arg, env) != 0) { ctx->error(ctx, "respawn failed: %s:%d", s->name, wl->idx); return; |