[Python-bugs-list] [ python-Bugs-526357 ] cmd.py does not flush stdout

noreply@sourceforge.net noreply@sourceforge.net
Wed, 06 Mar 2002 04:51:23 -0800


Bugs item #526357, was opened at 2002-03-06 21: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: Jonathan Gardner (jgardn)
Date: 2002-03-06 21: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