From 3c4bfb96952e259e9a824e15d3922a65d0e05e5f Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Thu, 28 Apr 2016 12:49:50 -0500 Subject: [PATCH] Fix parsing args with spaces in SVN backend. --- lib/kgrader/backend/svn.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/kgrader/backend/svn.rb b/lib/kgrader/backend/svn.rb index a63b783..a5f04be 100644 --- a/lib/kgrader/backend/svn.rb +++ b/lib/kgrader/backend/svn.rb @@ -1,6 +1,7 @@ require 'io/console' require 'nokogiri' require 'open3' +require 'shellwords' module KGrader::Backend class SVN @@ -54,9 +55,10 @@ module KGrader::Backend end def commit(repo, message, *paths) - fullpaths = paths.map { |fn| File.join repo, fn } - run 'add', *fullpaths - run 'commit', '-m', message, *fullpaths + Dir.chdir(repo) do + run 'add', *paths + run 'commit', '-m', message, *paths + end end def commit_date(repo) @@ -70,7 +72,7 @@ module KGrader::Backend temp = '.svn_temp_' + rand(1000000000).to_s begin File.write temp, @password - Open3.capture2e("cat #{temp} | xargs svn #{cmd.join ' '} --password") + Open3.capture2e("cat #{temp} | xargs svn #{cmd.shelljoin} --password") ensure File.unlink temp end