Spawn a background process in Ruby on Windows? Spawn a background process in Ruby on Windows? windows windows

Spawn a background process in Ruby on Windows?


The win32-process library, part of the Win32Utils suite, is probably what you're after.

http://win32utils.rubyforge.org/

The win32-process library adds the Process.create and Process.fork methods for MS Windows. In add addition, it provides different implementations of the wait, wait2, waitpid, and waitpid2 methods. The Process.create method allows you to create native MS Windows processes using a variety of different configuration options.

The Process.fork implementation should be considered experimental and not used in production code.

Installation: gem install win32-process


Charles's answer is great. I also discovered that I can utilize Windows's start, for example to execute the dir command as such:

system('start dir')

This spawns a cmd window along with the process, which is undesirable in some circumstances. However, if this is tolerable, then you don't need the win32-process dependency :)