popen3 on windows and interactive subprocesses
David Bolen
db3l at fitlinxx.com
Thu Dec 13 15:10:26 EST 2001
More information about the Python-list mailing list
Thu Dec 13 15:10:26 EST 2001
- Previous message (by thread): popen3 on windows and interactive subprocesses
- Next message (by thread): popen3 on windows and interactive subprocesses
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
bsturk at news.rcn.com (Brian Sturk) writes: > I have a script that is run from within the editor vim. It uses > popen2.popen3 to run cmd.exe. I then grab stdout and submit commands > to it via stdin. It works pretty well right now except for one thing. > When I spawn an *interactive* process, like ftp or cleartool I no longer > see anything on stdout after it's launched. Is this possibly because > the app is writing directly to the win32 console? Any help/ideas greatly > appreciated. It depends on the application. It could be that it is writing directly to the console, but it could also just be that it is buffering its output since it is no longer talking directly to a console. Interactive applications often show this quickly because they print a prompt, but no newline, and then wait for input. The lack of newline prevents line buffering from flushing that line. You'll see this issue even with Python itself unless you manually specify non-buffered with '-u' on the command line. I don't know of a good way under Windows to defeat this unless the application has such an option. Under Unix, you can use something like a pty to make the application think it's actually talking to a terminal although doing so portably across systems can be a black art mastered by few (such as 'expect'). -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/
- Previous message (by thread): popen3 on windows and interactive subprocesses
- Next message (by thread): popen3 on windows and interactive subprocesses
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list