in reply to Re: Managing Process Handles
in thread Managing Process Handles

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.

Replies are listed 'Best First'.
Re: Re: Re: Managing Process Handles
by rir (Vicar) on Oct 19, 2002 at 17:36 UTC
    there's no way around losing at least one print statement after the pipe process exits

    So interleave innocuous commands between the other messages.

    My suggestion is based on the assumption that a brittle kluge is all that is needed.