> It's all fine when running this from bash (we're on ubuntu) but when
> using ruby (with either system, backtick or #x) it's blocking until both
> the original process and the forked process terminate.
> 
> Is it what we should expect when calling system? If yes, how could we
> work around that?

Mine doesn't seem to do that.

rdp@li49-39:~$ cat spawn.rb
Process.fork {
 puts 'in daemon'
 puts Process.pid
 sleep
}
puts 'terminating'

rdp@li49-39:~$ cat spawn2.rb
system("~/installs/ruby_trunk_installed/bin/ruby spawn.rb")
puts 'done'

rdp@li49-39:~$ ruby -v spawn2.rb
ruby 1.8.6 (2009-3-4 mbari 8B/0x8770 on patchlevel 287) [i686-linux]
terminating
done
in daemon
3199
rdp@li49-39:~$ ps -ef | grep 3199
rdp       3199     1  0 17:41 pts/0    00:00:00 
/home/rdp/installs/ruby_trunk_installed/bin/ruby spawn.rb
rdp       3272   477  0 17:41 pts/0    00:00:00 grep 3199


(3199 is still alive).

Perhaps your other process.wait'ing on the first or something?

One thing that might help (in 1.9)
Process.daemon {
 # something
}

or

Process.fork {
  Thread.new { system("long running command")}
}

or what not.

GL.
-rp
-- 
Posted via http://www.ruby-forum.com/.