summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorxibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-03 16:15:23 +0000
committerxibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-03 16:15:23 +0000
commitae8ad5ae270e06b251d3ef412c9337919e9d6933 (patch)
treee9399977979b96bfa482535ba16c25f37c83eff3 /lib
parent19bad26c5a6af53ba792cc4ef153488a917254d6 (diff)
downloadruby-ae8ad5ae270e06b251d3ef412c9337919e9d6933.tar.gz
* lib/cgi/core.rb: fix command-line option of
non-interactive terminal. [ruby-core:23016] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/cgi/core.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb
index 02daf14e50..240d3bb714 100644
--- a/lib/cgi/core.rb
+++ b/lib/cgi/core.rb
@@ -555,12 +555,21 @@ class CGI
%|(offline mode: enter name=value pairs on standard input)\n|
)
end
- readlines.join(' ').gsub(/\n/, '')
- end.gsub(/\\=/, '%3D').gsub(/\\&/, '%26')
+ array = nil
+ begin
+ readlines
+ rescue
+ end
+ if not array.nil?
+ array.join(' ').gsub(/\n/n, '')
+ else
+ ""
+ end
+ end.gsub(/\\=/n, '%3D').gsub(/\\&/n, '%26')
words = Shellwords.shellwords(string)
- if words.find{|x| /=/.match(x) }
+ if words.find{|x| /=/n.match(x) }
words.join('&')
else
words.join('+')