Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
Glish creates and manages asynchronous shell clients (i.e., created using the shell function's async=T option; see § 10.9, 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, because its output appears unpredictably.
Each line of output generated by the shell command results in a string-valued stdout event (as discussed in § 7.8.2, page . shell_client itself responds to the following events: