Glish creates and manages asynchronous shell clients (i.e., created using the shell function's async=T option; see § 9.10, page ) using a special client called shell_client. shell_client is invoked with an optional -ping argument (to implement ping=T) and then a list of arguments corresponding to the shell command.
Prior to executing the shell command, shell_client attempts to create a ``pseudo tty" master/slave pair. If successful then it uses the pseudo-tty for the shell command's stdin and stdout; this causes the command to believe it is communicating directly with a user, so it will generate prompts, perhaps use terminal escape sequences where appropriate, and, most importantly, line-buffer its output.
If shell_client fails to create a pseudo-tty then it uses a pair of pipes to communicate with the command. In this case, the commands' output will be block-buffered, meaning that it may not appear at all until the command has either generated a lot of output, or terminates. This behavior makes the shell command much more difficult to use as a Glish client, since its output appears unpredictably.
As discussed in § 7.8.2, page , each line of output generated by the shell command results in a string-valued stdout event. shell_client itself responds to the following events: