[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

"print" not showing immediately in output, but "puts" is

Aryk Grosz

10/9/2008 7:29:00 PM

Several times I have come across this issue. It seems to be dependent on
the environment, but I'll do a "print 'string'" and it wont show up
UNTIL I do a "puts". Then both strings will show up in the output window
in one shot.

Do you know how I can fix it to work properly?
--
Posted via http://www.ruby-....

4 Answers

Rob Biedenharn

10/9/2008 7:37:00 PM

0

On Oct 9, 2008, at 3:28 PM, Aryk Grosz wrote:

> Several times I have come across this issue. It seems to be
> dependent on
> the environment, but I'll do a "print 'string'" and it wont show up
> UNTIL I do a "puts". Then both strings will show up in the output
> window
> in one shot.
>
> Do you know how I can fix it to work properly?


It's your terminal doing line buffering on the output.

Try:
$stdout.flush = true

Then see how it works for you.

-Rob

Rob Biedenharn http://agileconsult...
Rob@AgileConsultingLLC.com


Aryk Grosz

10/10/2008 12:34:00 AM

0

Thanks for the information Rob.

Should I run this line before each "print" command or do I just need to
run it once upon application startup?


Rob Biedenharn wrote:
> On Oct 9, 2008, at 3:28 PM, Aryk Grosz wrote:
>
>> Several times I have come across this issue. It seems to be
>> dependent on
>> the environment, but I'll do a "print 'string'" and it wont show up
>> UNTIL I do a "puts". Then both strings will show up in the output
>> window
>> in one shot.
>>
>> Do you know how I can fix it to work properly?
>
>
> It's your terminal doing line buffering on the output.
>
> Try:
> $stdout.flush = true
>
> Then see how it works for you.
>
> -Rob
>
> Rob Biedenharn http://agileconsult...
> Rob@AgileConsultingLLC.com

--
Posted via http://www.ruby-....

Victor H. Goff III

10/10/2008 1:02:00 AM

0

[Note: parts of this message were removed to make it a legal post.]

STDOUT.flush needs to be put after output, but before a gets call, for
example... however, STDOUT.sync=true can be done just once, and it sets the
output to be flushed each time there is output.
Warmest Regards,

On Thu, Oct 9, 2008 at 7:33 PM, Aryk Grosz <tennisbum2002@hotmail.com>wrote:

> Thanks for the information Rob.
>
> Should I run this line before each "print" command or do I just need to
> run it once upon application startup?
>
>
>

Aryk Grosz

10/10/2008 9:02:00 AM

0

great, that seems to do it.
--
Posted via http://www.ruby-....