Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
ExternalCommandShell
Last updated at 10:26 pm UTC on 22 December 2007
ExternalCommandShell is part of the CommandShell package. It provides a mechanism for connecting the a CommandShell to the standard input, output and error streams of the OS process for the Squeak virtual machine. With these connections in place, the keyboard input from the console or terminal session in which Squeak runs are sent to a running instance of CommandShell in the Squeak image. Command lines are assembled and submitted to the CommandShell. The output and error streams of the CommandShell are directed to the output and error streams connected to the console or terminal session.

To start an ExternalCommandShell, evaluate this expression:

The stop the ExternalCommandShell processing, evaluate:

When using Squeak with an ExternalCommandShell running, be sure that the Squeak VM is not started in background mode. In other words, do not use an '&' at the end of a unix command line to run Squeak. In addition, be careful not to let normal unix shell job control (for example by entering a ^Z character) place the Squeak VM in background, as this will cause the entire VM process to be stopped by job control (you can of course bring it back to the foreground, but the effect is rather disconcerting from the point of view of the Squeak image).

It is quite possible to run Squeak as a headless image, and interact with it on a terminal session connected to a CommandShell. Prepare the image in any manner necessary to operated headless, start the ExternalCommandShell, save the image, and run it with the "-headless" option. A suitably prepared image can also be set up for use as a Unix login shell, replacing the normal login shell (typically /bin/sh or /usr/bash) with a headless Squeak running ExternalCommandShell.