summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2014-12-09 19:23:36 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2014-12-09 19:23:36 +0000
commit9a184bf853688eae450c938dee953c7c1bce0d0c (patch)
tree45e332ed1e595342e418e088629e7282707d7436 /usr.bin
parent8388ddea0c592f19abc7a6dc6557f32d4d9bf1c7 (diff)
Add pane_dead_status for exit status of dead panes.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/format.c10
-rw-r--r--usr.bin/tmux/server.c3
-rw-r--r--usr.bin/tmux/tmux.15
-rw-r--r--usr.bin/tmux/tmux.h3
4 files changed, 15 insertions, 6 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index c9d01631d66..7abe2dbb304 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.54 2014/12/02 23:19:45 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.55 2014/12/09 19:23:35 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -17,6 +17,7 @@
*/
#include <sys/types.h>
+#include <sys/wait.h>
#include <ctype.h>
#include <errno.h>
@@ -581,6 +582,7 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
unsigned long long size;
u_int i, idx;
char *cmd;
+ int status;
if (ft->w == NULL)
ft->w = wp->window;
@@ -604,9 +606,13 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
format_add(ft, "pane_title", "%s", wp->base.title);
format_add(ft, "pane_id", "%%%u", wp->id);
format_add(ft, "pane_active", "%d", wp == wp->window->active);
- format_add(ft, "pane_dead", "%d", wp->fd == -1);
format_add(ft, "pane_input_off", "%d", !!(wp->flags & PANE_INPUTOFF));
+ status = wp->status;
+ if (wp->fd == -1 && WIFEXITED(status))
+ format_add(ft, "pane_dead_status", "%d", WEXITSTATUS(status));
+ format_add(ft, "pane_dead", "%d", wp->fd == -1);
+
if (window_pane_visible(wp)) {
format_add(ft, "pane_left", "%u", wp->xoff);
format_add(ft, "pane_top", "%u", wp->yoff);
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c
index 7208e124a03..da8f82ed49d 100644
--- a/usr.bin/tmux/server.c
+++ b/usr.bin/tmux/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.117 2014/10/27 22:23:47 nicm Exp $ */
+/* $OpenBSD: server.c,v 1.118 2014/12/09 19:23:35 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -441,6 +441,7 @@ server_child_exited(pid_t pid, int status)
continue;
TAILQ_FOREACH(wp, &w->panes, entry) {
if (wp->pid == pid) {
+ wp->status = status;
server_destroy_pane(wp);
break;
}
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 649fde05650..bcfae79ca32 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.410 2014/12/02 23:39:02 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.411 2014/12/09 19:23:35 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 2 2014 $
+.Dd $Mdocdate: December 9 2014 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -3117,6 +3117,7 @@ The following variables are available, where appropriate:
.It Li "pane_bottom" Ta "" Ta "Bottom of pane"
.It Li "pane_current_command" Ta "" Ta "Current command if available"
.It Li "pane_dead" Ta "" Ta "1 if pane is dead"
+.It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane"
.It Li "pane_height" Ta "" Ta "Height of pane"
.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
.It Li "pane_in_mode" Ta "" Ta "If pane is in a mode"
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index f1afd79a4fc..87d5831335b 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.483 2014/12/02 23:19:45 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.484 2014/12/09 19:23:35 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -890,6 +890,7 @@ struct window_pane {
pid_t pid;
char tty[TTY_NAME_MAX];
+ int status;
u_int changes;
struct event changes_timer;