Am Dienstag, dem 12. März 2002 um 21:23:25, schrieb Thomas Guettler:
Ich rufe mit popen3 einen Shell-Befehl auf. Ich möchte die Standard-Ausgabe und die Standard-Eingabe lesen.
Standard-Eingabe lesen? Sicher?
Code (Python):
Ich kenne die Details von Python nicht, aber ich denke, dass folgende Warnung dort auch gilt:
$ perldoc IPC::Open3 ... If you try to read from the child's stdout writer and their stderr writer, you'll have problems with blocking, which means you'll want to use select() or the IO::Select, which means you'd best use sysread() instead of readline() for normal stuff.
This is very dangerous, as you may block forever. It assumes it's going to talk to something like bc, both writing to it and reading from it. This is presumably safe because you "know" that commands like bc will read a line at a time and output a line at a time. Programs like sort that read their entire input stream first, however, are quite apt to cause deadlock. ...
Torsten