Why isatty never identifies that my program is using redirected stdin when using emacs? This is my code:
int val = isatty(STDIN_FILENO);
std::cout << val << std::endl;
If I launch my program from eshell (emacs): ./a.out
it will return 1, and if I launch ls | ./a.out
it will also return 1.
Why does it happen? Which conditions trigger this? Launching this from python (using POPEN(shell=True)) is safe?
Details: From the manpage for isatty(): isatty - test whether a file descriptor refers to a terminal. http://linux.die.net/man/3/isatty