Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Parent process waiting for child process

by adpinc (Initiate)
on Oct 06, 2011 at 05:48 UTC ( #929941=perlquestion: print w/replies, xml ) Need Help??
adpinc has asked for the wisdom of the Perl Monks concerning the following question:

Hello there! I'm a long time Perl writer. I've been writing Perl scripts for years. This is the first time I've ever hit a roadblock that a simple google search or flip through one of my books didn't help. I've written many webpages with Works great. I have come across a need to spawn a background process and want the parent to continue after launching the code. I've tried embedding the '&' in a system call. I've tried leading with a "1" and a "nohup." I've tried Proc::Background and Proc::Simple. I've tried various fork() code snippets. I've tried setting $|=1. No matter what happens, when my webpage code hits the line to spawn the background process, the webpage waits until the child process completes before continuing. The background process works fine. I just cannot seem to get the Parent process calling the child to simply move on to the next line of code. I am on a Linux platform running Perl 5.008008. Any help would be greatly appreciated. Thank you! adpinc
  • Comment on Parent process waiting for child process

Replies are listed 'Best First'.
Re: Parent process waiting for child process
by Corion (Pope) on Oct 06, 2011 at 07:01 UTC
      I think the step most people overlook, is that when you use fork, then child process has to 'close STDOUT', in order to "break the connection" to the web server.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://929941]
Approved by lidden
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2017-10-23 20:12 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (285 votes). Check out past polls.