I’m trying to run an ftp session by opening 2 pipes in my main app and then
spawning the “ftp” utility with the write end of one of the pipes assigned
to stdout of the spawned “ftp” and the read end of the other pipe assigned
to the stdin of “ftp”. I can write to the ftp’s stdin through the one pipe
successfully (I see it make a connection and open another fd to the server).
If, I also assign ftp’s stderr to same pipe as its stdout, I can read error
messages from ftp in my main app. However, I’m unable to read anything from
the pipe that should be directed to ftp’s stdout.
I note from “sin fd” that fd’s 0,1,2 are all marked as being connected to
“pipe”. I also note that ftp has no other fd’s open (until I open an ftp
session by writing through the pipe to ftp’s stdin).
If I replace ftp by my own app that simply writes something to its stdout, I
can read that output from the pipe in my main program
If I replace ftp by telnet, I see the normal telnet stdout output delivered
along the pipe.
What’s special about ftp’s stdout in this scenario? - anyone have any ideas