cgi = CGI.new causes the script to hang

Discussion in 'Ruby' started by Gavri Savio Fernandez, Nov 30, 2003.

  1. 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
    Gavri Savio Fernandez, Nov 30, 2003
    #1
    1. Advertising

  2. Gavri Savio Fernandez

    ts Guest

    >>>>> "G" == Gavri Savio Fernandez <> writes:

    G> i don't know what i'm doing wrong, but the following code outputs
    G> 'before' and never outputs 'after'. it seems to be stuck in CGI.new.
    G> 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
    ts, Nov 30, 2003
    #2
    1. Advertising

  3. Gavri Savio Fernandez

    Ara.T.Howard Guest

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

    > Date: Mon, 1 Dec 2003 02:54:37 +0900 From: Gavri Savio Fernandez
    > <> 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


    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
    --

    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 :: http://www.ngdc.noaa.gov/stp/
    | 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'
    ===============================================================================
    Ara.T.Howard, Dec 1, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jesse Cates via DotNetMonster.com

    Process.Start is causes application to hang

    Jesse Cates via DotNetMonster.com, Jan 28, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    3,526
    Steve C. Orr [MVP, MCSD]
    Jan 31, 2005
  2. Nishi Bhonsle
    Replies:
    2
    Views:
    23,516
    pahujadeepanshu
    Nov 30, 2009
  3. Earl Eiland
    Replies:
    1
    Views:
    455
    Dennis Lee Bieber
    Mar 19, 2005
  4. Jeff Epler
    Replies:
    0
    Views:
    360
    Jeff Epler
    Mar 19, 2005
  5. John
    Replies:
    2
    Views:
    138
Loading...

Share This Page