mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-28 01:40:17 -05:00
input: pipe-{visible,scrollback}: redirect stdout/stderr to /dev/null
This commit is contained in:
parent
765b714642
commit
22c73eaf4b
1 changed files with 13 additions and 1 deletions
14
input.c
14
input.c
|
|
@ -163,6 +163,14 @@ execute_binding(struct seat *seat, struct terminal *term,
|
||||||
goto pipe_err;
|
goto pipe_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int stdout_fd = open("/dev/null", O_WRONLY);
|
||||||
|
int stderr_fd = open("/dev/null", O_WRONLY);
|
||||||
|
|
||||||
|
if (stdout_fd < 0 || stderr_fd < 0) {
|
||||||
|
LOG_ERRNO("failed to open /dev/null");
|
||||||
|
goto pipe_err;
|
||||||
|
}
|
||||||
|
|
||||||
char *text;
|
char *text;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
|
@ -196,7 +204,7 @@ execute_binding(struct seat *seat, struct terminal *term,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!spawn(term->reaper, NULL, argv, pipe_fd[0], -1, -1))
|
if (!spawn(term->reaper, NULL, argv, pipe_fd[0], stdout_fd, stderr_fd))
|
||||||
goto pipe_err;
|
goto pipe_err;
|
||||||
|
|
||||||
/* Not needed anymore */
|
/* Not needed anymore */
|
||||||
|
|
@ -219,6 +227,10 @@ execute_binding(struct seat *seat, struct terminal *term,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
pipe_err:
|
pipe_err:
|
||||||
|
if (stdout_fd >= 0)
|
||||||
|
close(stdout_fd);
|
||||||
|
if (stderr_fd >= 0)
|
||||||
|
close(stderr_fd);
|
||||||
if (pipe_fd[0] >= 0)
|
if (pipe_fd[0] >= 0)
|
||||||
close(pipe_fd[0]);
|
close(pipe_fd[0]);
|
||||||
if (pipe_fd[1] >= 0)
|
if (pipe_fd[1] >= 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue