Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: exec with cleanup

by roju (Friar)
on Jun 07, 2004 at 14:14 UTC ( [id://361984]=note: print w/replies, xml ) Need Help??


in reply to exec with cleanup

How about this?

END{ $ENV{"PARENT"} = $$; if ($pid = fork()) { //do whatever your script does to end else { wait({$ENV{"PARENT"}}); exec (foo); } }

Although considering how fork works, you could just do

END { if ($pid = fork()) { wait($pid); exec(foo); } else { //finish your process off } }

Now, either way, the process that wait's is still going to have a copy of all the descriptors and stuff, but that shouldn't be a huge problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://361984]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-18 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found