diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-12 18:42:03 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-12 18:42:03 +0000 |
commit | 8c72fc9bf09071300b6283411b4481456aac7e34 (patch) | |
tree | 7b107fcfad5476a304edf94b6f9a119cee1d8c7d /lib/shellwords.rb | |
parent | 44d20d61c7babae9fd2ac3c6578208efa631d5a3 (diff) | |
download | ruby-8c72fc9bf09071300b6283411b4481456aac7e34.tar.gz |
* lib/shellwords.rb (Shellwords#shellsplit): Fix a bug where
consecutive backslashes in double quotes are all removed except
the one at the tail.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/shellwords.rb')
-rw-r--r-- | lib/shellwords.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/shellwords.rb b/lib/shellwords.rb index a83d1f1c86..20ddfe2646 100644 --- a/lib/shellwords.rb +++ b/lib/shellwords.rb @@ -41,7 +41,7 @@ module Shellwords line.scan(/\G\s*(?>([^\s\\\'\"]+)|'([^\']*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|\z)?/m) do |word, sq, dq, esc, garbage, sep| raise ArgumentError, "Unmatched double quote: #{line.inspect}" if garbage - field << (word || sq || (dq || esc).gsub(/\\(?=.)/, '')) + field << (word || sq || (dq || esc).gsub(/\\(.)/, '\\1')) if sep words << field field = '' |