146 reputation
1
bio website
location
age
visits member for 3 years
seen Aug 16 '13 at 15:37

Dec
28
comment Can a command line program prevent its output being redirected?
If you are not running in a tty, but instead in a pty, you can find that by looking at procfs (/proc/$PID/fd/0 etc). To write to the appropriate pty, go to your parent process's fd directory and see if it's a symlink to /dev/pts/[0-9]+. Then you write to that device (or recurse if it isn't a pts).