lib/virtualbox/command.rb in virtualbox-0.5.2 vs lib/virtualbox/command.rb in virtualbox-0.5.3

- old
+ new

@@ -91,9 +91,16 @@ # Shell escapes a string. This is almost a direct copy/paste from # the ruby mailing list. I'm not sure how well it works but so far # it hasn't failed! def shell_escape(str) + if Platform.windows? + # Special case for windows. This is probably not 100% bullet proof + # but it gets the job done until we find trouble + str = "\"#{str}\"" if str =~ /\s/ + return str + end + str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\'). gsub(/\n/, "'\n'"). sub(/^$/, "''") end end \ No newline at end of file