summaryrefslogtreecommitdiff
path: root/lib/shellwords.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/shellwords.rb')
-rw-r--r--lib/shellwords.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/shellwords.rb b/lib/shellwords.rb
index 99c0bf8437..e87b9e656b 100644
--- a/lib/shellwords.rb
+++ b/lib/shellwords.rb
@@ -41,8 +41,8 @@ module Shellwords
snippet = $1
elsif line =~ /\A'/ then
raise ArgumentError, "Unmatched single quote: #{line}"
- elsif line.sub!(/\A\\(.)/, '') then
- snippet = $1
+ elsif line.sub!(/\A\\(.)?/, '') then
+ snippet = $1 || '\\'
elsif line.sub!(/\A([^\s\\'"]+)/, '') then
snippet = $1
else