# Process.detach - not detaching child?

**URL:** <https://www.ruby-forum.com/t/process-detach-not-detaching-child/117341>\
**Category:** Ruby\
**Created:** [October 16, 2007, 3:06am UTC](https://www.ruby-forum.com/t/process-detach-not-detaching-child/117341 "2007-10-16T03:06:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [October 16, 2007, 3:06am UTC](https://www.ruby-forum.com/t/process-detach-not-detaching-child/117341/1 "2007-10-16T03:06:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [October 16, 2007, 4:04pm UTC](https://www.ruby-forum.com/t/process-detach-not-detaching-child/117341/2 "2007-10-16T16:04:49Z")

</div>

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
