Project

General

Profile

Bug #14429 ยป shellwords-plus.patch

jeremyevans0 (Jeremy Evans), 06/20/2019 08:26 PM

View differences:

lib/shellwords.rb
# Treat multibyte characters as is. It is the caller's responsibility
# to encode the string in the right encoding for the shell
# environment.
str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/, "\\\\\\1")
str.gsub!(/([^A-Za-z0-9_\-.,:+\/@\n])/, "\\\\\\1")
# A LF cannot be escaped with a backslash because a backslash + LF
# combo is regarded as a line continuation and simply ignored.
test/test_shellwords.rb
assert_equal "ps -p #{$$}", joined
end
def test_shellescape
assert_equal "''", shellescape('')
assert_equal "\\^AZaz09_\\\\-.,:/@'\n'+\\'\\\"", shellescape("^AZaz09_\\-.,:\/@\n+'\"")
end
def test_whitespace
empty = ''
space = " "
    (1-1/1)