Cgi = CGI.new causes the script to hang

hi,
i don’t know what i’m doing wrong, but the following code outputs ‘before’ and never outputs ‘after’. it seems to be stuck in CGI.new.
does anyone know what might be the problem here?

···

require ‘cgi’
$stdout.sync = true
puts 'before’
cgi = CGI.new
puts ‘after’

thank you

Gavri Savio Fernandez


What if everything is an illusion and nothing exists? In that case, I definitely overpaid for my carpet. - Woody Allen

       i don't know what i'm doing wrong, but the following code outputs
'before' and never outputs 'after'. it seems to be stuck in CGI.new.
  does anyone know what might be the problem here?

It's trying to read name=value pairs on standard input.

Use Control-D (^D) on un*x or ^Z (???) on windows, to close the input.

Guy Decoux

guy already mentioned it’s reading from standard in. one thing that’s useful
for testing is:

~ > cat input
key=value
foo=bar

~ > foo.cgi < input

this should work on windows, *nix, whatever.

-a

···

On Mon, 1 Dec 2003, Gavri Savio Fernandez wrote:

Date: Mon, 1 Dec 2003 02:54:37 +0900 From: Gavri Savio Fernandez
Gavri_F@infosys.com Newsgroups: comp.lang.ruby Subject: cgi = CGI.new
causes the script to hang

hi, i don’t know what i’m doing wrong, but the following code outputs
‘before’ and never outputs ‘after’. it seems to be stuck in CGI.new. does
anyone know what might be the problem here? ---- require ‘cgi’ $stdout.sync
= true puts ‘before’ cgi = CGI.new puts ‘after’ ----

thank you

Gavri Savio Fernandez


What if everything is an illusion and nothing exists? In that case, I
definitely overpaid for my carpet. - Woody Allen

ATTN: please update your address books with address below!

===============================================================================

EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
STP :: Solar-Terrestrial Physics Data | NCEI
NGDC :: http://www.ngdc.noaa.gov/
NESDIS :: http://www.nesdis.noaa.gov/
NOAA :: http://www.noaa.gov/
US DOC :: http://www.commerce.gov/

The difference between art and science is that science is what we
understand well enough to explain to a computer.
Art is everything else.
– Donald Knuth, “Discover”

/bin/sh -c ‘for l in ruby perl;do $l -e “print "\x3a\x2d\x29\x0a"”;done’
===============================================================================