Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 5c5098a

Browse files
committed
Fix rake task arg quoting on Windows.
1 parent 43b464b commit 5c5098a

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Enhancements:
1313
Bug Fixes:
1414

1515
* Handle invalid UTF-8 strings within exception methods. (Benjamin Fleischer, #1760)
16+
* Fix Rake Task quoting of file names with quotes to work properly on
17+
Windows. (Myron Marston, #....)
1618

1719
### 3.2.1 / 2015-02-23
1820
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.2.0...v3.2.1)

lib/rspec/core/rake_task.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def file_inclusion_specification
128128

129129
if RSpec::Support::OS.windows?
130130
def escape(shell_command)
131-
"'#{shell_command.gsub("'", "\'")}'"
131+
"'#{shell_command.gsub("'", "\\\\'")}'"
132132
end
133133
else
134134
require 'shellwords'

spec/rspec/core/rake_task_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ def spec_command
4747
end
4848
end
4949

50+
context "on windows, with a quote in the name", :if => RSpec::Support::OS.windows? do
51+
it "renders rspec quoted, with quote escaped" do
52+
task.rspec_path = "/foo'bar/exe/rspec"
53+
expect(spec_command).to include(%q|'/foo\'bar/exe/rspec'|)
54+
end
55+
end
56+
5057
context "with ruby options" do
5158
it "renders them before the rspec path" do
5259
task.ruby_opts = "-w"

0 commit comments

Comments
 (0)