Permalink
Browse files

Merge pull request #728 from charliemaffitt/shellescape_backwards_com…

…patible

Defines shellescape method
  • Loading branch information...
2 parents 4d881e8 + f5e14f0 commit 6f991369ebc5340d2b6064d88f25e5235b7ffc58 @alindeman alindeman committed Nov 18, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/rspec/core/rake_task.rb
@@ -157,11 +157,21 @@ def run_task(verbose)
private
+ if RUBY_VERSION == '1.8.6'
+ def shellescape(string)
+ string.gsub(/"/, '\"').gsub(/'/, "\\\\'")
+ end
+ else
+ def shellescape(string)
+ string.shellescape
+ end
+ end
+
def files_to_run
if ENV['SPEC']
FileList[ ENV['SPEC'] ].sort
else
- FileList[ pattern ].sort.map { |f| f.shellescape }
+ FileList[ pattern ].sort.map { |f| shellescape(f) }
end
end

0 comments on commit 6f99136

Please sign in to comment.