homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: cmd.py does not flush stdout
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nascheme Nosy List: gvanrossum, jgardn, nascheme
Priority: normal Keywords:

Created on 2002年03月06日 12:14 by jgardn, last changed 2022年04月10日 16:05 by admin. This issue is now closed.

Messages (4)
msg9533 - (view) Author: Jonathan Gardner (jgardn) Date: 2002年03月06日 12:14
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.
msg9534 - (view) Author: Jonathan Gardner (jgardn) Date: 2002年03月06日 12:51
Logged In: YES 
user_id=126343
no_rawinput should be use_rawinput.
msg9535 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002年03月06日 13:49
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.
msg9536 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2002年03月23日 20:44
Logged In: YES 
user_id=35752
Fixed in cmd.py 1.27.
History
Date User Action Args
2022年04月10日 16:05:04adminsetgithub: 36209
2002年03月06日 12:14:18jgardncreate

AltStyle によって変換されたページ (->オリジナル) /