Buffered output on Windows

Quick question:

Why do I have to put

$stdout.sync = true

in my programs if I run them in Windows (it’s XP, if that matters), but not
in Linux? Here’s the program (it’s for my tutorial):

puts (‘Hello, and what is your name?’)
name = gets.chomp
puts (name+’? What a lovely name!’)
puts (‘Pleased to meet you, ‘+name+’. :)’)

In Linux, it works like you’d expect, but in Windows (unless I set
$stdout.sync = true), it doesn’t print the first line until the end. So the
program looks like it’s hanging when it’s waiting for the ‘gets’ to finish.

Is this on purpose? I’d rather not have to introduce '$stdout.sync = true’
right now. It seems like ‘true’ should be the default setting, anyway…
doesn’t it?

Chris

Why would you want to run your programs on Windows?

···

On Thursday, December 5, 2002, at 06:41 PM, Chris Pine wrote:

Quick question:

Why do I have to put

$stdout.sync = true

in my programs if I run them in Windows (it’s XP, if that matters),
but not
in Linux? [snip]

In Linux, it works like you’d expect, but in Windows (unless I set
$stdout.sync = true), it doesn’t print the first line until the end.
So the
program looks like it’s hanging when it’s waiting for the ‘gets’ to
finish.

Is this on purpose? I’d rather not have to introduce ‘$stdout.sync =
true’
right now. It seems like ‘true’ should be the default setting,
anyway…
doesn’t it?

Chris

Chris,

add an extra \n at the end of the line or the buffering will be non
coherent between the platforms.

···

On Fri, Dec 06, 2002, Chris Pine wrote:

Quick question:

Why do I have to put

$stdout.sync = true

in my programs if I run them in Windows (it’s XP, if that matters), but not
in Linux? Here’s the program (it’s for my tutorial):

puts (‘Hello, and what is your name?’)
name = gets.chomp
puts (name+‘? What a lovely name!’)
puts (‘Pleased to meet you, ‘+name+’. :)’)

In Linux, it works like you’d expect, but in Windows (unless I set
$stdout.sync = true), it doesn’t print the first line until the end. So the
program looks like it’s hanging when it’s waiting for the ‘gets’ to finish.

Is this on purpose? I’d rather not have to introduce ‘$stdout.sync = true’
right now. It seems like ‘true’ should be the default setting, anyway…
doesn’t it?

Chris


Pierre Baillet
Fight For your rights - We Can Put an End to Word Attachments - GNU Project - Free Software Foundation

Hi,

···

At Fri, 6 Dec 2002 08:41:43 +0900, Chris Pine wrote:

In Linux, it works like you’d expect, but in Windows (unless I set
$stdout.sync = true), it doesn’t print the first line until the end. So the
program looks like it’s hanging when it’s waiting for the ‘gets’ to finish.

How did you run the program? It worked in “DOS Prompt”.


Nobu Nakada

Why would you want to run your programs on Windows?

···

----- Original Message -----

Dude, it’s a tutorial! How successful is a tutorial which starts:

Chapter 1: Getting Started…

First, get a Linux box, because your windows machine sucks. Then I’ll
teach you to program.

I’m no Windows fan, myself, but I certainly won’t ask someone to switch to a
new OS before they read my tutorial.

OK… I’ll admit, I thought about it! :slight_smile: (“If you’re going to call
yourself a programmer…”) But really, it’s a cross-platform language for a
reason, and it should certainly be a cross-platform tutorial for the same
reasons.

Chris

That doesn’t make any difference. If he was using print, that would make
sense, but puts already adds the newline.

···

On Fri, 6 Dec 2002 11:14, Pierre Baillet wrote:

Chris,

add an extra \n at the end of the line or the buffering will be non
coherent between the platforms.

Chris,

add an extra \n at the end of the line or the buffering will be non
coherent between the platforms.

···

----- Original Message -----
From: “Pierre Baillet” oct@zoy.org


???

I don’t understand. Whether my first line is
puts (“Hello, and what is your name?”)
or
puts (“Hello, and what is your name?\n”)
or
puts (“Hello, and what is your name?\n\n”)

…I still have the same buffering problem. Anyway, puts adds an “\n” if
there’s not one.

Chris

Because 90% of the world runs Windows, and not all of us are Linux
zealots. I do most of my development on Windows, including my other
open source work – I try to test most of it on Linux, especially
the server-based stuff.

-austin
– Austin Ziegler, austin@halostatue.ca on 2002.12.05 at 20.39.41

···

On Fri, 6 Dec 2002 08:59:34 +0900, Mark Wilson wrote:

Why would you want to run your programs on Windows?

How did you run the program? It worked in “DOS Prompt”.

···

----- Original Message -----
From: nobu.nokada@softhome.net


Well, I’ll be damned… you’re right! I was running the program in the port
of rxvt which comes in the cygwin distribution, but I had good reason
(obviously not good enough) to believe that rxvt was not at fault:

When I said that the Linux version of ruby was fine, I was running that in
the same rxvt window! I just ssh’d over to my linux box and ran it there.

Why would that be?

As the PragProgs say: Don’t Assume It; Prove it. (That’s the second time
this week I’ve been bitten by not following that rule.)

Chris

When I said that the Linux version of ruby was fine, I was running that in
the same rxvt window! I just ssh’d over to my linux box and ran it there.

Why would that be?

Windows comes with its own (broken) version of rsh. CVS uses that to
talk with remote hosts. It might be that in rxvt you’re using the cygwin
version, but in the DOS box (and in your Ruby program) you’re running
the Windows one.

Dave

Hi,

Well, I’ll be damned… you’re right! I was running the program in the port
of rxvt which comes in the cygwin distribution, but I had good reason
(obviously not good enough) to believe that rxvt was not at fault:

When I said that the Linux version of ruby was fine, I was running that in
the same rxvt window! I just ssh’d over to my linux box and ran it there.

Why would that be?

It means rxvt cygwin port is incomplete yet. It uses a pipe to
connect child process, so non-cygwin children don’t recognize
it a tty. This issue is not limited to ruby, for example,
Borland’s tdump tool fails on rxvt too.

Windows fundamentally doesn’t have pseodo tty feature like on
UNIX but only special “console”. Japanese maintainer of rxvt
for cygwin at least has noticed this but cannot solve yet.

···

At Sat, 7 Dec 2002 07:41:48 +0900, Chris Pine wrote:


Nobu Nakada

So, is there a good Windows console out there? What are people’s favorites?
I know I don’t like the standard DOS one. rxvt is good most of the time,
but has problems with various things. Sometimes I run the cygwin port of
xterm in an xserver, but I don’t always like doing it that way.

Suggestions?

Chris

···

----- Original Message -----
From: nobu.nokada@softhome.net
Newsgroups: comp.lang.ruby
Sent: Friday, December 06, 2002 5:38 PM
Subject: Re: Buffered output on Windows

Hi,

At Sat, 7 Dec 2002 07:41:48 +0900, Chris Pine wrote:

Well, I’ll be damned… you’re right! I was running the program in the
port
of rxvt which comes in the cygwin distribution, but I had good reason
(obviously not good enough) to believe that rxvt was not at fault:

When I said that the Linux version of ruby was fine, I was running that in
the same rxvt window! I just ssh’d over to my linux box and ran it
there.

Why would that be?

It means rxvt cygwin port is incomplete yet. It uses a pipe to
connect child process, so non-cygwin children don’t recognize
it a tty. This issue is not limited to ruby, for example,
Borland’s tdump tool fails on rxvt too.

Windows fundamentally doesn’t have pseodo tty feature like on
UNIX but only special “console”. Japanese maintainer of rxvt
for cygwin at least has noticed this but cannot solve yet.


Nobu Nakada

Hi,

···

At Sun, 8 Dec 2002 12:20:38 +0900, Chris Pine wrote:

So, is there a good Windows console out there? What are people’s favorites?
I know I don’t like the standard DOS one. rxvt is good most of the time,
but has problems with various things. Sometimes I run the cygwin port of
xterm in an xserver, but I don’t always like doing it that way.

Well, I want to know it too…


Nobu Nakada

I think there is a stand alone port of rxvt, running with libx11.dll
or alike, withouth an xserver.
Maybe you can find it in msys (from mingw.,org)

But, I admit thet with little hacks on cmd.exe to use tab completion
for dir & commands, and so on, it fits good for me

···

On Sun, 8 Dec 2002 12:20:38 +0900, “Chris Pine” nemo@hellotree.com wrote:

So, is there a good Windows console out there? What are people’s favorites?
I know I don’t like the standard DOS one. rxvt is good most of the time,
but has problems with various things. Sometimes I run the cygwin port of
xterm in an xserver, but I don’t always like doing it that way.

So, is there a good Windows console out there? What are people’s favorites?
I know I don’t like the standard DOS one. rxvt is good most of the time,
but has problems with various things. Sometimes I run the cygwin port of
xterm in an xserver, but I don’t always like doing it that way.

I’m a little confused of what you’re actually looking for.
It sounds like you’re loking for a shell (bash,command.com,cmd.com,
tcsh) ?

rxvt however is a terminal to access a shell.

explain?

Personally, to do any commandline type work, I ssh using PuTTy
(PuTTY: a free SSH and Telnet client) to a UNIX shell of
choice.

db

···

On Sun, Dec 08, 2002 at 12:20:38PM +0900, Chris Pine wrote:

Suggestions?

Chris

----- Original Message -----
From: nobu.nokada@softhome.net
Newsgroups: comp.lang.ruby
Sent: Friday, December 06, 2002 5:38 PM
Subject: Re: Buffered output on Windows

Hi,

At Sat, 7 Dec 2002 07:41:48 +0900, > Chris Pine wrote:

Well, I’ll be damned… you’re right! I was running the program in the
port
of rxvt which comes in the cygwin distribution, but I had good reason
(obviously not good enough) to believe that rxvt was not at fault:

When I said that the Linux version of ruby was fine, I was running that in
the same rxvt window! I just ssh’d over to my linux box and ran it
there.

Why would that be?

It means rxvt cygwin port is incomplete yet. It uses a pipe to
connect child process, so non-cygwin children don’t recognize
it a tty. This issue is not limited to ruby, for example,
Borland’s tdump tool fails on rxvt too.

Windows fundamentally doesn’t have pseodo tty feature like on
UNIX but only special “console”. Japanese maintainer of rxvt
for cygwin at least has noticed this but cannot solve yet.


Nobu Nakada


A.D. 1844: Samuel Morse invents Morse code. Cryptography export
restrictions prevent the telegraph’s use outside the U.S. and Canada.

Chris Pine wrote:

So, is there a good Windows console out there? What are people’s favorites?
I know I don’t like the standard DOS one. rxvt is good most of the time,
but has problems with various things. Sometimes I run the cygwin port of
xterm in an xserver, but I don’t always like doing it that way.

Suggestions?

Chris

There’s 4NT (resp. 4DOS) by JP Soft http://www.jpsoft.com
They offer a trial version that you can use on 30 days. (Note that it
doesn’t read ‘during 30 days’). So, only the days you actually use it
count.

Stephan

I’m pretty happy with rxvt, though it does give problems. How about
running an ssh server and using putty to ssh to localhost? I was going
to try that before I discovered that rxvt didn’t need an X server, but
then I never got around to it.

martin

···

nobu.nokada@softhome.net wrote:

Hi,

At Sun, 8 Dec 2002 12:20:38 +0900, > Chris Pine wrote:

So, is there a good Windows console out there? What are people’s favorites?
I know I don’t like the standard DOS one. rxvt is good most of the time,
but has problems with various things. Sometimes I run the cygwin port of
xterm in an xserver, but I don’t always like doing it that way.

Well, I want to know it too…

nobu.nokada@softhome.net wrote in message
news:200212080435.gB84ZT511901@sharui.nakada.kanuma.tochigi.jp…

Hi,

So, is there a good Windows console out there? What are people’s
favorites?
I know I don’t like the standard DOS one. rxvt is good most of the
time,
but has problems with various things. Sometimes I run the cygwin port
of
xterm in an xserver, but I don’t always like doing it that way.

Well, I want to know it too…

If you happen to be using command.exe switch to cmd.exe - it’s significantly
better for what it’s worth.

There was a windows port of zsh, but I’m afraid it is not up to date. I gave
up on it, but perhaps things have improved. At least unxutils has a lot of
good stuff.

http://unxutils.sourceforge.net/
ftp://ftp.blarg.net/users/amol/zsh (win32 port)
http://www.zsh.org/
http://www.zshwiki.org/cgi-bin/wiki.pl

I’d prefer Ruby as CLI, but it’s not quite tuned for that.

Mikkel

···

At Sun, 8 Dec 2002 12:20:38 +0900, > Chris Pine wrote:

Sorry. I guess I should have been more specific. I like bash a lot and am
happy with it. I’m looking for a terminal.

I have run bash in cmd.com and in rxvt, and I like rxvt much better. I was
just wondering if there was another one people favored more. Actually, I’m
interested in what linux terminals people use, too. I have settled on
multi-gnome-terminal, myself, but I’m open for suggestions.

My primary criteria are that programs run “like they are supposed to”, and
ease of customability (font, colors, etc.). In windows, my biggest issues
are with fonts. There are very few fonts I can use with cmd.com (which is
inferior to rxvt, anyway), and even less with rxvt (at least that I have
figured out).

So, I was wondering what terminals people recommend? (As was stated earlier
in this thread, rxvt seems to give me problems from time to time.)

Chris

···

----- Original Message -----
From: “Daniel Bretoi” lists@debonair.net
Newsgroups: comp.lang.ruby
Sent: Sunday, December 08, 2002 3:08 PM
Subject: Re: Good windows console? (was: Buffered output on Windows)

On Sun, Dec 08, 2002 at 12:20:38PM +0900, Chris Pine wrote:

So, is there a good Windows console out there? What are people’s
favorites?
I know I don’t like the standard DOS one. rxvt is good most of the
time,
but has problems with various things. Sometimes I run the cygwin port of
xterm in an xserver, but I don’t always like doing it that way.

I’m a little confused of what you’re actually looking for.
It sounds like you’re loking for a shell (bash,command.com,cmd.com,
tcsh) ?

rxvt however is a terminal to access a shell.

explain?

Personally, to do any commandline type work, I ssh using PuTTy
(PuTTY: a free SSH and Telnet client) to a UNIX shell of
choice.

db

Suggestions?

Chris

----- Original Message -----
From: nobu.nokada@softhome.net
Newsgroups: comp.lang.ruby
Sent: Friday, December 06, 2002 5:38 PM
Subject: Re: Buffered output on Windows

Hi,

At Sat, 7 Dec 2002 07:41:48 +0900, > Chris Pine wrote:

Well, I’ll be damned… you’re right! I was running the program in the
port
of rxvt which comes in the cygwin distribution, but I had good reason
(obviously not good enough) to believe that rxvt was not at fault:

When I said that the Linux version of ruby was fine, I was running that
in
the same rxvt window! I just ssh’d over to my linux box and ran it
there.

Why would that be?

It means rxvt cygwin port is incomplete yet. It uses a pipe to
connect child process, so non-cygwin children don’t recognize
it a tty. This issue is not limited to ruby, for example,
Borland’s tdump tool fails on rxvt too.

Windows fundamentally doesn’t have pseodo tty feature like on
UNIX but only special “console”. Japanese maintainer of rxvt
for cygwin at least has noticed this but cannot solve yet.


Nobu Nakada


A.D. 1844: Samuel Morse invents Morse code. Cryptography export
restrictions prevent the telegraph’s use outside the U.S. and Canada.

There was a windows port of zsh, but I’m afraid it is not up to date. I gave
up on it, but perhaps things have improved. At least unxutils has a lot of
good stuff.

The Cygwin port of zsh should be perfect. I tried it, was happy, but
ultimately didn’t put enough effort in. So I’m back with bash.

Gavin

···

From: “MikkelFJ” mikkelfj-anti-spam@bigfoot.com