[Python-bugs-list] [ python-Bugs-526357 ] cmd.py does not flush stdout
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 06 Mar 2002 05:49:37 -0800
Bugs item #526357, was opened at 2002-03-06 07:14
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=526357&group_id=5470
Category: Python Library
Group: Python 2.1.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Jonathan Gardner (jgardn)
Assigned to: Nobody/Anonymous (nobody)
Summary: cmd.py does not flush stdout
Initial Comment:
The module cmd (located in cmd.py in the library) does not flush stdout
before it waits for input.
What does that mean? That means that unless you are running cmd
from the terminal, or unless stdout happens to magically flush before it
waits for new input, that there will be no data written to stdout before it
waits for input.
This is a problem if you want to fork() a module that uses cmd, or set it
up to work with sockets as stdout and stdin.
When running in no_rawinput=1 mode (should that be renamed to
no_raw_input?) , it executes the following code:
79 sys.stdout.write(self.prompt)
80 line = sys.stdin.readline()
It should read:
79 sys.stdout.write(self.prompt)
80 sys.stdout.flush()
81 line = sys.stdin.readline(79
There may also be a problem with raw_input(). raw_input should flush
stdout before asking for input. I'll submit a seperate bug report for that.
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-06 08:49
Message:
Logged In: YES
user_id=6380
Might it have occurred to you that you're the first person
ever who's using cmd in a situation where it's not talking
directly to a real human user? I agree that this should
probably be fixed, but it's got low priority compared to
many other bugs.
PS. The convention is that if you have a fix for a bug, you
submit a patch, not a bug report. And please use context
diffs in attachments, never out the patch in the initial bug
description.
----------------------------------------------------------------------
Comment By: Jonathan Gardner (jgardn)
Date: 2002-03-06 07:51
Message:
Logged In: YES
user_id=126343
no_rawinput should be use_rawinput.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=526357&group_id=5470