Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-26-2009, 01:16 AM   #1
LQ Newbie
Registered: Feb 2009
Posts: 2

Rep: Reputation: 0
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.
Old 03-02-2009, 01:01 AM   #2
LQ Newbie
Registered: Feb 2009
Posts: 2

Original Poster
Rep: Reputation: 0
What would happen if I close STDOUT and STDERR before launching the execA executable?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Which is the parent and child process in given command? brownaryan Linux - Newbie 1 06-30-2008 06:17 PM
parent and child processes skora Programming 5 11-02-2003 10:41 AM
about parent and child process winwar Solaris / OpenSolaris 3 07-23-2003 06:07 AM
child and parent process error jdevanand Programming 1 04-29-2002 08:13 AM
child-parent-&-fork mukul Programming 2 03-24-2001 01:12 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:36 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration