# Process.create equivalent on ubuntu

**URL:** <https://www.ruby-forum.com/t/process-create-equivalent-on-ubuntu/170518>\
**Category:** Ruby\
**Created:** [June 18, 2009, 2:08pm UTC](https://www.ruby-forum.com/t/process-create-equivalent-on-ubuntu/170518 "2009-06-18T14:08:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![virendra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e68b1a/32.png) [@virendra](https://www.ruby-forum.com/u/virendra)\
**Post date:** [June 18, 2009, 2:08pm UTC](https://www.ruby-forum.com/t/process-create-equivalent-on-ubuntu/170518/1 "2009-06-18T14:08:43Z")

</div>

hello everyone

I am currently stuck with the Ruby process

I was previous working on windows and with the help of win32-process gem  
I was able to achieve this

starter = ‘ruby test.rb’

pid = Process.create(:app\_name =\> starter)

this work fine under windows

Now in ubuntu when i am trying to achieve this same thing with fork  
it doesn’t work

the ruby code under ubuntu is like this

starter = ‘ruby test.rb’  
pid = Process.fork {starter}

is there something that i am missing any where

thanks anyway

---

<div class="post-metadata">

**Author:** ![virendra](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e68b1a/32.png) [@virendra](https://www.ruby-forum.com/u/virendra)\
**Post date:** [June 18, 2009, 5:26pm UTC](https://www.ruby-forum.com/t/process-create-equivalent-on-ubuntu/170518/2 "2009-06-18T17:26:32Z")

</div>

On 18 Jun 2009, at 13:08, Virendra N. wrote:

> this work fine under windows
> 
> Now in ubuntu when i am trying to achieve this same thing with fork  
> it doesn’t work
> 
> the ruby code under ubuntu is like this
> 
> starter = ‘ruby test.rb’  
> pid = Process.fork {starter}
> 
> is there something that i am missing any where

The easiest approach:

starter = ‘ruby test.rb’  
pid = spawn starter  
Process::waitpid2 pid # if you want to wait on the process to  
finish

or if yo want more flexibility:

starter = %w{ruby test.rb}  
exec \*starter unless pid = fork

There’s a brief write-up of both spawn and exec in the “Ruby Plumber’s  
Guide” presentations at the link in my sig.

Ellie

## Eleanor McHugh Games With Brains [http://slides.games-with-brains.net](http://slides.games-with-brains.net)

raise ArgumentError unless @reality.responds\_to? :reason
