On Mon, 14 Aug 2006, Bill Kelly wrote: > From: "John Carter" <john.carter / tait.co.nz> >> >> Ps: (What do Windowsy types do instead of "Process.fork"? ) > > Cry, mostly. It depends on how close to fork() your needs are. If your need is really closer to a fork & exec than just a fork, it's not too hard. I posted this code in another thread the other day, but here's a method I use in a test suite to allow the code to create new processes on Windows and *nix. It requires Daniel Berger's win32/process lib, but with that in hand -- no problem. module IWATestSupport def self.create_process(args) @fork_ok = true unless @fork_ok == false pid = nil begin raise NotImplementedError unless @fork_ok unless pid = fork Dir.chdir args[:dir] exec(*args[:cmd]) end rescue NotImplementedError @fork_ok = false begin require 'rubygems' rescue Exception end begin require 'win32/process' rescue LoadError raise "Please install win32-process to run all tests on a Win32 platform. 'gem install win32-process' or http://rubyforge.org/projects/win32utils" end cwd = Dir.pwd Dir.chdir args[:dir] pid = Process.create(:app_name => args[:cmd].join(' ')) Dir.chdir cwd end pid end end Kirk Haines