aboutsummaryrefslogtreecommitdiff
path: root/bb.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-06-18 21:16:32 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-06-18 21:16:32 -0700
commita57b5f44dbc0f494639da67cf7acf8e156d6921f (patch)
tree844324aeac824427ec17854fa2d3a9d6c5a43d28 /bb.c
parent0b977d2a8f0e850735775a870d810c4589a4dfb3 (diff)
Removed all the /dev/tty redirection and just dup2()'d it before
exec()ing the user scripts
Diffstat (limited to 'bb.c')
-rw-r--r--bb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bb.c b/bb.c
index 47a4bbf..a2dd99f 100644
--- a/bb.c
+++ b/bb.c
@@ -291,6 +291,11 @@ int run_script(bb_t *bb, const char *cmd)
setenv("BBDOTFILES", bb->show_dotfiles ? "1" : "", 1);
setenv("BBCURSOR", bb->nfiles ? bb->files[bb->cursor]->fullname : "", 1);
+ int ttyout, ttyin;
+ ttyout = open("/dev/tty", O_RDWR);
+ ttyin = open("/dev/tty", O_RDONLY);
+ dup2(ttyout, STDOUT_FILENO);
+ dup2(ttyin, STDIN_FILENO);
execvp("sh", args);
err("Failed to execute command: '%s'", cmd);
return -1;