Browse files

• Use `quoted_path` in the command string passed to `bash`.

• Add test to verify that Rush::Dir.bash works for paths with spaces.
  • Loading branch information...
1 parent 130084d commit bd6550ad1f477ce860407bdd903ed8a85279076a @mkhl mkhl committed with Jan 25, 2009
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/rush/dir.rb
  2. +5 −0 spec/dir_spec.rb
View
2 lib/rush/dir.rb
@@ -122,7 +122,7 @@ def nonhidden_files
# Run a bash command starting in this directory. Options are the same as Rush::Box#bash.
def bash(command, options={})
- box.bash "cd #{full_path} && #{command}", options
+ box.bash "cd #{quoted_path} && #{command}", options
end
# Destroy all of the contents of the directory, leaving it fresh and clean.
View
5 spec/dir_spec.rb
@@ -151,6 +151,11 @@
@dir.bash("cat file").should == "test\n"
end
+ it "can run bash within directories with spaces" do
+ @dir.create_dir('with space').create_file('file').write('test')
+ @dir["with space/"].bash("cat file").should == "test"
+ end
+
it "passes bash options (e.g., :user) through to the box bash command" do
@dir.should_receive(:bash).with('cmd', :opt1 => 1, :opt2 => 2)
@dir.bash('cmd', :opt1 => 1, :opt2 => 2)

0 comments on commit bd6550a

Please sign in to comment.