Greg Minshall
2020-Mar-16 19:06 UTC
[Rd] pipe(): input to, and output from, a single process
Gabor, thanks. yes, managing the two-way communication is always a bit error-prone, as it depends on the input/output characteristics of the two ends -- they either match, or deadlock. it's too bad if polling is always *required* -- i'd think sometimes a programmer would be happy blocking, though other times one wants better control over when to block. cheers, Greg
Gábor Csárdi
2020-Mar-16 19:17 UTC
[Rd] pipe(): input to, and output from, a single process
Well, if you want blocking, you can poll with an infinite timeout. This returns if 1) there is output, 2) the process terminates, or 3) you interrupt with CTRL+C / ESC /etc. and then right after the polling, you can read the output. This still works if the process has finished already. Gabor On Mon, Mar 16, 2020 at 7:06 PM Greg Minshall <minshall at umich.edu> wrote:> > Gabor, thanks. yes, managing the two-way communication is always a bit > error-prone, as it depends on the input/output characteristics of the > two ends -- they either match, or deadlock. it's too bad if polling is > always *required* -- i'd think sometimes a programmer would be happy > blocking, though other times one wants better control over when to > block. cheers, Greg