Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8192883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:17:09+00:00 2026-06-07T04:17:09+00:00

So if I download and run the following code using curl, gets produces nil

  • 0

So if I download and run the following code using curl, gets produces nil and doesn’t prompt anything.

str=gets
unless str.nil?
  puts str
else
  puts "gets produced nil"
end

Command being used (you can try it yourself)

curl https://raw.github.com/gist/3077534/06ea1c27f7bed38408d2662671f29ea758e2e54b/gets_test.rb | ruby

Is there a better/more common practice of doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:17:13+00:00Added an answer on June 7, 2026 at 4:17 am

    This may work for you:

    tty = STDIN.reopen('/dev/tty')
    
    tty.each_line do |line|
      break if line == "\n"
      puts line
    end
    
    tty.close
    

    It does for me:

    $ curl https://raw.github.com/gist/3078191 | ruby
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   106  100   106    0     0     84      0  0:00:01  0:00:01 --:--:--   153
    foo
    foo
    foobar
    foobar
    now pressing enter ...
    now pressing enter ...
     
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When i run the following command in the visual studio command prompt: D:\Documents\DEV\SARPilot\Docs\eoschema\schema\OrderSchema>svcutil /t:code
Please download the following code : http://media.pragprog.com/titles/eband3/code/Sudokuv2/src/org/example/sudoku/PuzzleView.java In the code, What initial value does
I grabbed the following code somewhere off the Internet, and I am using it
I'm using the following code to accept bad server certificates: ServicePointManager.ServerCertificateValidationCallback = delegate(object s,
Just run into a tricky NSFetchedResultsController problem. The following code works fine in all
So I have download the source code successfully, built it successfully, and can run
So I have created the following code snippet to run in a formula to
I am trying to download a source code from code.google.com using git command but
I've following code for file download: FileInfo fileInfo = new FileInfo(filePath); context.Response.Clear(); context.Response.ContentType =
I am trying to execute the following code. The code tries to parallely download

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.