Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!VAF@score.stanford.edu From: VAF@score.stanford.edu (Vince Fuller) Newsgroups: comp.unix.wizards Subject: Obscure UNIX question Message-ID: <12472@brl-adm.ARPA> Date: 17 Mar 88 19:28:29 GMT Sender: news@brl-adm.ARPA Lines: 23 I am attempting to write an application that will talk to a child process via a PTY. I want to make this communication as completely half duplex as possible, e.g. my program sends a command string to the PTY then reads the response and processes it. Because I do not have control over the format of the output from the child process and it is safe to assume that it is synchronous (i.e. it reads its input, generates some output, then reads some more input), I want to be able to read output from the PTY until the child blocks for input. Is there any way for me to detect that the child process has done this (blocked for input)? My groveling about in the UNIX manual pages for pty(4), tty(4), et. al. hasn't gotten me anywhere. Alternatively, if it is not possible to do what I want, can someone suggest an alternative method to write this application? In summary, what I want to do is two step loop in the parent process: 1) Send command to child process by writing on master end of PTY. 2) Read and process child's output by reading from master end of PTY until child is finished processing the command. The child is considered to be "finished" when it blocks for input while reading from the slave end of PTY - this is the state that I need to be able to detect. Thanks, Vince Fuller, Stanford Networking Systems ------- -------