LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File descriptors shared between child and parent causing parent to hang. (http://www.linuxquestions.org/questions/linux-newbie-8/file-descriptors-shared-between-child-and-parent-causing-parent-to-hang-707643/)

bharadiaam 02-26-2009 01:16 AM

File descriptors shared between child and parent causing parent to hang.
 
Hi There,
I fork a child which is a very long process. Parent exits immediately. This all code has been written in C producing an executable. lets call it execA. I cannot change this code.
Now from perl I call this executable. this perl file is invoked through CGI. Currently I am invoking this file using ``(backticks). The parent process exits fro execA. After that the perl program exits as expected. But the CGI call doesn't exit. It waits for child to exit. Now how should I call the execA from perl so that as soon as parent process exits CGI should exit.
As far as I understand the file descriptors for child and parent process are same. Hence STDOUT stream is not closed of parent process according to CGI.
I have tried closing STDOUT and STDERR in perl program but doesnt work.
Correct me if I am wrong anywhere.
Hope I am pretty clear with my problem.

bharadiaam 03-02-2009 01:01 AM

What would happen if I close STDOUT and STDERR before launching the execA executable?


All times are GMT -5. The time now is 11:18 AM.