# How to spawn an idependent child procees on Win32?

**URL:** <https://www.ruby-forum.com/t/how-to-spawn-an-idependent-child-procees-on-win32/69966>\
**Category:** Ruby\
**Created:** [September 25, 2006, 11:09pm UTC](https://www.ruby-forum.com/t/how-to-spawn-an-idependent-child-procees-on-win32/69966 "2006-09-25T23:09:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dokondr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3be4f8/32.png) [@dokondr](https://www.ruby-forum.com/u/dokondr)\
**Post date:** [September 25, 2006, 11:09pm UTC](https://www.ruby-forum.com/t/how-to-spawn-an-idependent-child-procees-on-win32/69966/1 "2006-09-25T23:09:24Z")

</div>

How to create an idependent child procees on Win32 so parent:

1. after spawning child could continue without blocking and not waiting  
for child to exit
2. could kill new process
3. get notified when child exits

What is the best way to do this in Ruby? Should I use ‘fork’? How parent  
can be notified about child exit? Any examples I can look at?

Sorry if I am asking questions belonging to some FAQ, maybe I wasn’t  
researching this long enough, but I have very little time to find  
answers these days ☹

Thanks!  
Dima

---

<div class="post-metadata">

**Author:** ![dokondr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3be4f8/32.png) [@dokondr](https://www.ruby-forum.com/u/dokondr)\
**Post date:** [September 25, 2006, 11:25pm UTC](https://www.ruby-forum.com/t/how-to-spawn-an-idependent-child-procees-on-win32/69966/2 "2006-09-25T23:25:59Z")

</div>

On Tue, 26 Sep 2006, Dmitri K. wrote:

> How to create an idependent child procees on Win32 so parent:

Take a look at Daniel B.'s win32-process library. Find it at:

[http://rubyforge.org/projects/win32utils/](http://rubyforge.org/projects/win32utils/)

Kirk H.

---

<div class="post-metadata">

**Author:** ![dokondr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3be4f8/32.png) [@dokondr](https://www.ruby-forum.com/u/dokondr)\
**Post date:** [September 26, 2006, 8:47am UTC](https://www.ruby-forum.com/t/how-to-spawn-an-idependent-child-procees-on-win32/69966/3 "2006-09-26T08:47:44Z")

</div>

Hi,

At Tue, 26 Sep 2006 06:09:26 +0900,  
Dmitri K. wrote in [ruby-talk:216370]:

> How to create an idependent child procees on Win32 so parent:
> 
> 1. after spawning child could continue without blocking and not waiting  
> for child to exit
> 2. could kill new process
> 3. get notified when child exits
> 
> What is the best way to do this in Ruby? Should I use ‘fork’? How parent  
> can be notified about child exit? Any examples I can look at?

$ ./ruby -v -e ‘p pid = spawn(%[./ruby -e “sleep 3”]), Time.now; p  
Process.wait(pid), Time.now; p $?’  
ruby 1.9.0 (2006-09-19) [i386-mingw32]  
2360  
2006-09-26 15:41:13 +0900  
2360  
2006-09-26 15:41:16 +0900  
#\<Process::Status: pid=2360,exited(0)\>
