[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Process.detach - not detaching child?

goodieboy

10/16/2007 1:06:00 AM

Hi,

I've got a script that was working great on OS X and now not working
on Fedora Core 6. Both are running Ruby 1.8.6 and the latest Rails.
The application is a Rails app that uses fork and the Process.detach.
On OS X, the process gets detached and all is well, but on Fedora I
the parent process hangs and waits for the child to finish.

I need to fork some code, and make sure it's detached from the parent
so there is no waiting. What's the best way to do this?

Matt


1 Answer

goodieboy

10/16/2007 2:04:00 PM

0

OK,

What I've found out is that is does indeed get detached from the
parent. The problem is, there is a lag time longer than I experienced
on another OS/environment. If I remove all of the code from the fork,
it's very quick. So it seems (obviously) that it starts running the
code in the fork block before it gets detached. The parent waits for
about 2-3 seconds (too long!) and then the forked process is detached.
The 2-3 seconds happens whenver the code block takes longer than that.
If it takes 10 seconds, the parent still takes 2-3 seconds to detach
the fork. How can I make that fork detach happen instantly? :) Is it
possible?

Matt

On Oct 15, 9:06 pm, goodieboy <goodie...@gmail.com> wrote:
> Hi,
>
> I've got a script that was working great on OS X and now not working
> on Fedora Core 6. Both are running Ruby 1.8.6 and the latest Rails.
> The application is a Rails app that uses fork and the Process.detach.
> On OS X, the process gets detached and all is well, but on Fedora I
> the parent process hangs and waits for the child to finish.
>
> I need to fork some code, and make sure it's detached from the parent
> so there is no waiting. What's the best way to do this?
>
> Matt