ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* gets is blocking print in simple example
@ 2008-01-16 23:35 David A. Black
       [not found] ` <478FDAAC.2010608@rubychan.de>
  2008-01-18  1:04 ` Yukihiro Matsumoto
  0 siblings, 2 replies; 3+ messages in thread
From: David A. Black @ 2008-01-16 23:35 UTC (permalink / raw
  To: ruby-core

Hi --

When I run this in 1.9:

   print "Hello. Please enter your name: "
   name = gets

I get nothing; it doesn't print the prompt until after I've entered a
keyboard line.

It works in 1.8. I'm assuming this is a bug (I can't imagine that we
have to manually flush STDOUT just to print a prompt), but I thought
I'd run it by the list and see if anyone has any comments or insight.


David

-- 
Training for 2008!
Ruby on Rails training by David A. Black/Ruby Power and Light, LLC:
    * Intro to Rails, New York, NY, February 4-7 2008
    * Advancing With Rails, New York, NY, February 11-14 2008
Hosted by Exceed Education. See http://www.rubypal.com for details!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gets is blocking print in simple example
       [not found] ` <478FDAAC.2010608@rubychan.de>
@ 2008-01-18  0:35   ` David A. Black
  0 siblings, 0 replies; 3+ messages in thread
From: David A. Black @ 2008-01-18  0:35 UTC (permalink / raw
  To: ruby-core

Hi --

On Fri, 18 Jan 2008, Kornelius Kalnbach wrote:

> David A. Black wrote:
>> When I run this in 1.9:
>>
>>   print "Hello. Please enter your name: "
>>   name = gets
>> 
>> I get nothing; it doesn't print the prompt until after I've entered a
>> keyboard line.
> whenever I get those kind of problems, I do set $stdout.sync = true adn it 
> works. It seems to happen randomly without it.

It's certainly possible to do that, but it seems awfully heavy for
something that (I think) should just work. And this is happening in a
simple example I'm using early in a tutorial -- I hate to have to
explain that stdout requires explicit handling in the first exercise
:-)


David

-- 
Training for 2008!
Ruby on Rails training by David A. Black/Ruby Power and Light, LLC:
    * Intro to Rails, New York, NY, February 4-7 2008
    * Advancing With Rails, New York, NY, February 11-14 2008
Hosted by Exceed Education. See http://www.rubypal.com for details!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gets is blocking print in simple example
  2008-01-16 23:35 gets is blocking print in simple example David A. Black
       [not found] ` <478FDAAC.2010608@rubychan.de>
@ 2008-01-18  1:04 ` Yukihiro Matsumoto
  1 sibling, 0 replies; 3+ messages in thread
From: Yukihiro Matsumoto @ 2008-01-18  1:04 UTC (permalink / raw
  To: ruby-core

Hi,

Fixed today.  Thanks for pointing it out.

							matz.

In message "Re: gets is blocking print in simple example"
    on Thu, 17 Jan 2008 08:35:16 +0900, "David A. Black" <dblack@rubypal.com> writes:

|When I run this in 1.9:
|
|   print "Hello. Please enter your name: "
|   name = gets
|
|I get nothing; it doesn't print the prompt until after I've entered a
|keyboard line.
|
|It works in 1.8. I'm assuming this is a bug (I can't imagine that we
|have to manually flush STDOUT just to print a prompt), but I thought
|I'd run it by the list and see if anyone has any comments or insight.
|
|David

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-18  1:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-16 23:35 gets is blocking print in simple example David A. Black
     [not found] ` <478FDAAC.2010608@rubychan.de>
2008-01-18  0:35   ` David A. Black
2008-01-18  1:04 ` Yukihiro Matsumoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).