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,7 +8225,13 @@ int main(int argc, char *argv[])
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
/* We return to tty */
|
/* We return to tty */
|
||||||
dup2(STDOUT_FILENO, STDIN_FILENO);
|
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)
|
if (session)
|
||||||
session = NULL;
|
session = NULL;
|
||||||
|
|
Loading…
Reference in a new issue