ddollar/foreman — pull request #359 by kjwierenga (2013-05-02 15:04:25+00:00)
Title: Fix specs that were broken on ruby 1.8. Use POSIX::Spawn.spawn to make foreman robust on ruby 1.8.7.

This pull request fixes ruby 1.8 incompatibilities. Specs are now passing on ruby 1.8.7 (on travis). This also fixes orphaned process trouble running foreman from runit on Ubunutu Linux (and others probably).

My goal was to start a ruby 1.8 app using runit. The main problem was that running foreman from runit caused orphaned processes. I managed to track the problem down to Foreman::Process#run which uses Kernel.exec on ruby 1.8.7. Passing a command with a space causes ruby 1.8.7 to shell out using (/bin/sh -c). This caused orphaned processs on Ubuntu Linux when running from runit.

First made specs 1.8.7 compatible as much as possible. Then fixed the bug by using POSIX::Spawn#spawn; splitting the command using String#shellsplit and passing the resulting array using the ruby splat operator (*) to POSIX::Spawn.spawn.

All specs now passing on ruby 1.8.7 and orphaned processes bug fixed.