Hey Monks,
I am currently trying to open a process and send it some data, however the process (written in c) which i am trying to run, tests to make sure it is connected to a tty using the "isatty()" function.
Here is an example C program to describe what i mean.
#include <stdio.h>
int main(int ac, char** av)
{
if (isatty(fileno(stdout)))
printf("Is a tty!\n");
}
I was wondering if there is any way for me to run this program from within my perl script, while still proving that if statement true and then send the program data to it's stdin.
If i open the process using 'open()' then i am not attached to a valid tty, however if i run it using 'system()' i am unable to send data to it.
Once way i've thought of doing this is to run it using 'system()' then grep the tty of the pid, then open the tty and write to it, but this seems like a hack and i'm not sure if it will work?
Any help would be appreciated.
Neil Archibald