Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bundle exec rspec spec/ => invalid switch in RUBYOPT: -F (RuntimeError)

Tags:

ruby

bundler

When I run bundle exec rspec spec/ on my Windows 7 64bit system, I receive the following error:

invalid switch in RUBYOPT: -F (RuntimeError)

I'm running ruby 1.9.2p136 (2010-12-25) [i386-mingw32] (installed in c:\Program Files (x86)\Ruby192), and bundler 1.0.15 (installed as a ruby gem).

Any clues on how to fix this issue?

Thanks,
Ben

like image 707
Ben Gribaudo Avatar asked Feb 03 '23 17:02

Ben Gribaudo


1 Answers

Bundler doesn't like the fact that Ruby's path contains spaces.

To fix the problem, I edited runtime.rb (in %RUBYDIR%\lib\ruby\gems\1.9.1\gems\bundler-1.0.15\lib\bundler), changing line 147 (inside def setup_environment) from:

rubyopt.unshift "-I#{File.expand_path('../..', __FILE__)}"

to:

rubyopt.unshift "\"-I#{File.expand_path('../..', __FILE__)}\""

This surrounds the entire option with quotes so that Ruby interprets it as a single option.

like image 149
Ben Gribaudo Avatar answered Feb 05 '23 17:02

Ben Gribaudo