mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Open controlling terminal for input when run in a script
This commit is contained in:
parent
3a98dfb0b0
commit
25fab4cb2e
|
@ -8225,6 +8225,12 @@ int main(int argc, char *argv[])
|
|||
return EXIT_FAILURE;
|
||||
|
||||
/* We return to tty */
|
||||
if (!isatty(STDOUT_FILENO)) {
|
||||
fd = open(ctermid(NULL), O_RDWR, 0400);
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDIN_FILENO);
|
||||
close(fd);
|
||||
} else
|
||||
dup2(STDOUT_FILENO, STDIN_FILENO);
|
||||
|
||||
if (session)
|
||||
|
|
Loading…
Reference in a new issue