mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Add a pipe-pane command to allow a pane to be piped to a shell command, for
example: pipe-pane 'cat >~/out' No arguments stops outputing and closes the pipe; the -o flag toggles a pipe and on and off (useful for key bindings). Suggested by espie@.
This commit is contained in:
17
server.c
17
server.c
@ -572,6 +572,13 @@ server_fill_windows(void)
|
||||
if (BUFFER_USED(wp->out) > 0)
|
||||
events |= POLLOUT;
|
||||
server_poll_add(wp->fd, events);
|
||||
|
||||
if (wp->pipe_fd == -1)
|
||||
continue;
|
||||
events = 0;
|
||||
if (BUFFER_USED(wp->pipe_buf) > 0)
|
||||
events |= POLLOUT;
|
||||
server_poll_add(wp->pipe_fd, events);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -600,6 +607,16 @@ server_handle_windows(void)
|
||||
wp->fd = -1;
|
||||
} else
|
||||
server_handle_window(w, wp);
|
||||
|
||||
if (wp->pipe_fd == -1)
|
||||
continue;
|
||||
if ((pfd = server_poll_lookup(wp->pipe_fd)) == NULL)
|
||||
continue;
|
||||
if (buffer_poll(pfd, NULL, wp->pipe_buf) != 0) {
|
||||
buffer_destroy(wp->pipe_buf);
|
||||
close(wp->pipe_fd);
|
||||
wp->pipe_fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
server_check_window(w);
|
||||
|
Reference in New Issue
Block a user