Hmm. Okay, maybe I was being a bit rash when I said the
short answer to "2." was "no" -- what I should have said was
"yes, sort of, but you don't really get your desired result".
At least, as I understand the OP, it would not be desirable
to write a statement to the pipe handle after the downstream
process has ended.
And based on my experiments (simple-minded, but functional,
I think), there's no way around losing at least one print
statement after the pipe process exits (because the previous
statement caused that process to terminate on its own
initiative).
Another thought -- not pretty, but... -- opening a pipe
returns a pid, right? and maybe there's something that one
could do within a loop, before printing to the pipe handle,
to see if that pid is still running.
| [reply] |
| [reply] |