From bc1b118b95d5d4c12274f06012adc44083f9ba53 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Wed, 5 Jun 2019 15:11:16 -0400 Subject: [PATCH] cmd_exec{,_always}: close standard in for child This just closes the standard input for processes started with the exec and exec_always commands. This prevents interactive programs like vi(m) from taking over input on the getty. Standard output and standard error are kept open, which allows for the output/errors to be captured along with the sway log. --- sway/commands/exec_always.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index a57242950..f0be5dd03 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c @@ -61,6 +61,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) { close(fd[0]); if ((child = fork()) == 0) { close(fd[1]); + close(STDIN_FILENO); execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL); _exit(0); }