summaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authornicm <nicm>2017-07-03 08:16:03 +0000
committernicm <nicm>2017-07-03 08:16:03 +0000
commit28687f2d55fb30654a7164bf1445f47b052ea115 (patch)
treeff0f9efa87a6ba860533a7c3c9d505c351783d71 /window.c
parent42285ac9893f6ce82b44d00061a4ef702ef22cbe (diff)
Do not close panes until process has exited and any outstanding data
has been written to the pipe-pane event if there is one. GitHub issue 991.
Diffstat (limited to 'window.c')
-rw-r--r--window.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/window.c b/window.c
index ce5166c8..55739c0e 100644
--- a/window.c
+++ b/window.c
@@ -388,6 +388,19 @@ window_destroy(struct window *w)
free(w);
}
+int
+window_pane_destroy_ready(struct window_pane *wp)
+{
+ if (wp->pipe_fd != -1 && EVBUFFER_LENGTH(wp->pipe_event->output) != 0)
+ return (0);
+
+ if (~wp->flags & PANE_EXITED)
+ return (0);
+ if (~wp->flags & PANE_ERROR)
+ return (0);
+ return (1);
+}
+
void
window_add_ref(struct window *w, const char *from)
{
@@ -1000,7 +1013,11 @@ window_pane_error_callback(__unused struct bufferevent *bufev,
{
struct window_pane *wp = data;
- server_destroy_pane(wp, 1);
+ log_debug("%%%u error", wp->id);
+ wp->flags |= PANE_ERROR;
+
+ if (window_pane_destroy_ready(wp))
+ server_destroy_pane(wp, 1);
}
void