Process Starter

A gem for Ruby 1.8 to start process in parallel, 1) don’t wait for it finish 2) dont inherit io file handles 3) both in windows/linux. Ruby 1.9 dont need it because it has spawn method.

Usage

ProcessStarter.start(“somecmd arg1 arg2”)

will invoke ‘somecmd’ with command line arg1 arg2.

ProcessStarter.allowed_methods = [:psexec,:start,:spawn,:fork]

specify which methods are allowed to start the process. So we have psexec (if found on the target machine) and ‘cmd /c start …’ for windows, and spawn (if in ruby 1.9) or fork in linux. This is the default, but you can redefine it, for example: ProcessStarter.allowed_methods = [:start,:fork]

Also you can set allowed methods in command call:

ProcessStarter.start(“somecmd arg1 arg2”, [:start,:fork] )

This overrides ProcessStarter.allowed_methods values.

How to install

gem install process_starter

Ruby versions

Useful for Ruby 1.8, not so useful for Ruby 1.9

Todo

  • Add ‘win32/process’ start method.

  • Fix posix-spawn method (turned off at the moment).

Changelog

Found a bug? Fix it and email pull request to me: [email protected]

Want to add a feature? Implement it and email the patch!

Pavel Vasev [ [email protected] ]

Released under the MIT license (included)