-/* $OpenBSD: tmux.h,v 1.790 2017/07/03 08:16:03 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.791 2017/07/03 12:38:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
#define PANE_FOCUSPUSH 0x20
#define PANE_INPUTOFF 0x40
#define PANE_CHANGED 0x80
-#define PANE_ERROR 0x100
-#define PANE_EXITED 0x200
+#define PANE_EXITED 0x100
int argc;
char **argv;
-/* $OpenBSD: window.c,v 1.200 2017/07/03 08:16:03 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.201 2017/07/03 12:38:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
int
window_pane_destroy_ready(struct window_pane *wp)
{
- if (wp->pipe_fd != -1 && EVBUFFER_LENGTH(wp->pipe_event->output) != 0)
- return (0);
+ int n;
+
+ if (wp->pipe_fd != -1) {
+ if (EVBUFFER_LENGTH(wp->pipe_event->output) != 0)
+ return (0);
+ if (ioctl(wp->fd, FIONREAD, &n) != -1 && n > 0)
+ return (0);
+ }
if (~wp->flags & PANE_EXITED)
return (0);
- if (~wp->flags & PANE_ERROR)
- return (0);
return (1);
}
struct window_pane *wp = data;
log_debug("%%%u error", wp->id);
- wp->flags |= PANE_ERROR;
+ wp->flags |= PANE_EXITED;
if (window_pane_destroy_ready(wp))
server_destroy_pane(wp, 1);