aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicm <nicm>2017-07-03 12:38:50 +0000
committernicm <nicm>2017-07-03 12:38:50 +0000
commit6ee0afb579fc09cd36058b993f45eb2577a80e76 (patch)
treefec429120a6a5fa16170ae6283adbd3aa421a9b0
parent28687f2d55fb30654a7164bf1445f47b052ea115 (diff)
downloadrtmux-6ee0afb579fc09cd36058b993f45eb2577a80e76.tar.gz
rtmux-6ee0afb579fc09cd36058b993f45eb2577a80e76.tar.bz2
rtmux-6ee0afb579fc09cd36058b993f45eb2577a80e76.zip
Change previous to not wait for both process exit and pty close -
instead if there is a pipe-pane active, do not exit until all data is read (including any libevent hasn't seen yet). Fixes problem reported by Theo Buehler and still seems to solve the original issue.
-rw-r--r--tmux.h3
-rw-r--r--window.c14
2 files changed, 10 insertions, 7 deletions
diff --git a/tmux.h b/tmux.h
index 495106e6..1b515f58 100644
--- a/tmux.h
+++ b/tmux.h
@@ -768,8 +768,7 @@ struct window_pane {
#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;
diff --git a/window.c b/window.c
index 55739c0e..437a49d1 100644
--- a/window.c
+++ b/window.c
@@ -391,13 +391,17 @@ window_destroy(struct window *w)
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);
}
@@ -1014,7 +1018,7 @@ window_pane_error_callback(__unused struct bufferevent *bufev,
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);