[Chicago] capturing output from subprocesses

Jess Balint jbalint at gmail.com
Fri Nov 11 22:15:35 CET 2005

> The child process in the real application I want to use this for is
> written in fortran, so I can't use the techniques you mentioned.
> I had already sought out second and third opinions on this, so now I am
> really convinced that there is no way to get the effect I want without
> using pseudo-terminals.

Yes, I think that's the only thing you have influence on at this
point. Using forkpty() and connecting it to the pipe might work.
Another option might be to use an LD_PRELOAD with an init routine that
calls setbuf(). I am trying to find a simple, non-intrusive way to do
this, I will let you know if I come up with something.

> > The non-blocking io is not relevant to any of this.
> Too bad. If I can ask you one more thing: what is the proper purpose of
> using fcntl to set a file descriptor to non-blocking IO if not to achieve
> the behavior I'm looking for in this problem?

Non-blocking IO is something that allows a read() or write() call to
return when a file descriptor is not ready. So if you are reading from
a network connection and nothing has come through, a normal read()
call would block (and wait for something). A non-blocking attribute
added to the socket will allow a read() call to return so you can do
other stuff until it is ready.


More information about the Chicago mailing list