Add pane_pipe_pid with pipe fd and call setpgid to make it easier to kill.

This commit is contained in:
nicm
2026-03-05 09:22:08 +00:00
parent 6d37cc94a7
commit 1e208abd93
4 changed files with 20 additions and 1 deletions

View File

@@ -124,7 +124,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
/* Fork the child. */
sigfillset(&set);
sigprocmask(SIG_BLOCK, &set, &oldset);
switch (fork()) {
switch ((wp->pipe_pid = fork())) {
case -1:
sigprocmask(SIG_SETMASK, &oldset, NULL);
cmdq_error(item, "fork error: %s", strerror(errno));
@@ -137,6 +137,9 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
sigprocmask(SIG_SETMASK, &oldset, NULL);
close(pipe_fd[0]);
if (setpgid(0, 0) == -1)
_exit(1);
null_fd = open(_PATH_DEVNULL, O_WRONLY);
if (out) {
if (dup2(pipe_fd[1], STDIN_FILENO) == -1)