Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Without shellwords #179

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/interactive/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def shellsplit(line)
line.scan(/\G\s*(?>([^\s\\\'\"]+)|'([^\']*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|\z)?/) do
|word, sq, dq, esc, garbage, sep|
raise ArgumentError, "Unmatched double quote: #{line.inspect}" if garbage
field << (word || sq || (dq || esc))
field << (word || sq || (dq || esc).gsub(/(\\(x[0-9a-f]{2}|.))/) { eval('"%s"' % $1) })
if sep
words << field
field = ''
Expand Down Expand Up @@ -156,7 +156,7 @@ def format_reply(reply, prefix = "")
when Bignum
"(integer) " + reply.to_s + "\n"
when String
%Q{"%s"\n} % reply.force_encoding("ASCII")
reply.force_encoding("ASCII").inspect
when NilClass
"(nil)\n"
when Array
Expand Down