mirror of
https://github.com/tmux/tmux.git
synced 2026-06-20 17:25:57 +00:00
Merge branch 'obsd-master'
This commit is contained in:
34
window.c
34
window.c
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
@@ -380,6 +381,13 @@ window_pane_destroy_ready(struct window_pane *wp)
|
||||
|
||||
if (~wp->flags & PANE_EXITED)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* If a command queue item is blocked on this pane, wait for the
|
||||
* child's exit status before destroying it.
|
||||
*/
|
||||
if (wp->block_item != NULL && (~wp->flags & PANE_STATUSREADY))
|
||||
return (0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -1084,12 +1092,38 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
|
||||
return (wp);
|
||||
}
|
||||
|
||||
void
|
||||
window_pane_block_finish(struct window_pane *wp)
|
||||
{
|
||||
struct cmdq_item *item = wp->block_item;
|
||||
struct client *c;
|
||||
int retval = 0;
|
||||
|
||||
if (item == NULL)
|
||||
return;
|
||||
wp->block_item = NULL;
|
||||
|
||||
if (wp->flags & PANE_STATUSREADY) {
|
||||
if (WIFEXITED(wp->status))
|
||||
retval = WEXITSTATUS(wp->status);
|
||||
else if (WIFSIGNALED(wp->status))
|
||||
retval = WTERMSIG(wp->status) + 128;
|
||||
}
|
||||
|
||||
c = cmdq_get_client(item);
|
||||
if (c != NULL && c->session == NULL)
|
||||
c->retval = retval;
|
||||
cmdq_continue(item);
|
||||
}
|
||||
|
||||
static void
|
||||
window_pane_destroy(struct window_pane *wp)
|
||||
{
|
||||
struct window_pane_resize *r;
|
||||
struct window_pane_resize *r1;
|
||||
|
||||
window_pane_block_finish(wp);
|
||||
|
||||
window_pane_reset_mode_all(wp);
|
||||
free(wp->searchstr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user