mguinada/vlc-client — pull request #15 by justjake (2014-01-08 02:46:11+00:00)
Title: Use process spawn

This is a simple change from `Process::fork` and `Kernel.exec` to a much simpler call to `Process::spawn` when creating a VLC instance in a sub-process. This is required for JRuby usage, as JRuby doesn't support `fork()`.

I looked at updating your rspec tests, but the tests are far too closely coupled with the implementation of `VLC::Server`: any changes to the function calls made in `VLC::Server` will break the tests, even if the behavior of the program does not change.

For example, the following test helper would fail a perfectly good rewrite of `VLC::Server` because it doesn't `Dir::chdir` or `Process::daemon`:
```ruby
def mock_system_calls(opts = {})
if opts.fetch(:daemonized, false)
Process.should_receive(:fork).once.ordered.and_return(false)

if RUBY_VERSION < "1.9"
Process.should_receive(:setsid).once.ordered
Process.should_receive(:fork).once.ordered.and_return(false)
Dir.should_receive(:chdir).once.with("/")
else
Process.should_receive(:daemon).once
end
Process.should_receive(:pid).once.and_return(99)
```