[ENH][GOODIE] CommandShell V1.4 (version 1.4 released)

David T. Lewis lewis at mail.msen.com
Thu Nov 22 15:01:58 UTC 2001


CommandShell 1.4
Previous released version: CommandShell 1.3
Best if used with OSProcess 2.5

CommandShell is a Smalltalk simulation of a Unix command shell, with a
simple dumb terminal window in Morphic and MVC. It is useful for running
programs without leaving Squeak, and for piping command output directly
into Squeak. VM builders using VMMaker can use CommandShell to compile
and run new VMs and plugins without leaving Squeak.

CommandShell can be loaded and run on any platform, but is only
really useful on Unix systems with OSProcess (the shell, command line
parsing, internal commands, doIts, and so forth will work, but external
commands can only be run on a Unix system with OSProcess).

CommandShellV1-4.cs is the main change set.
CommandShell-sUnit-V1-4.cs contains SUnit tests for CommandShell (not required).
CommandShell-menu-V1-4.cs adds 'squeak shell' to the global menus.

Changes in CommandShell 1.4 since CommandShell 1.3:
- Fixes a timing problem for CommandShell pipelines running in MVC.
  Symptom: A command line such as '$ ls | edit' or '$ ls | inspect' did
  not work in an MVC shell window (Morphic was OK). The editor
  or inspector window would open and display an empty string.
  Cause: In MVC, the 'edit' and 'inspect' builtin commands scheduled
  an editor or inspector window to be opened at a later time using
  #addDeferredUIMessage:, and then cheerfully went on to close the
  input pipe for the command prior to the deferred action being
  executed.
  Fix: in a command pipeline, input to the 'edit' and 'inspect'
  shell builtin commands is now read completely prior to scheduling
  the editor or inspector window and closing the input pipe.
- Fixes a harmless but unappealing buglet in which the last proxy in
  a command pipeline was sent the #value message twice.
- Adds better error pipeline handling for command windows. Prior to
  this change, a command which generated a large amount our error
  output would clog up the pipes and cause the command window to
  hang up. I ran into the problem when running running configure
  and make to build a VM with VMMaker.
- Use deferred UI events in Morphic to eliminate intermittent red screen
  of death on '$ edit someBigFile' command.
- Fixed search for executable path in UnixCommandSyntax to properly
  handle the curent directory '.' in the PATH list.
- Added a #startUp handler to eliminate leftover Smalltalk processes
  after an image restart. The problem arose when a CommandShell
  ran an external program in background mode with a Smalltalk
  process waiting for the external program to exit. After an
  image restart, there was no way to be notified when the external
  process exited, so the Smalltalk process was left dangling forever.

Class CommandShell is a command shell, similar to /bin/sh, with a command
line user interface. It collaborates with process proxies to provide command
execution, and provides a limited set of built in commands similar to those
in a Unix shell. Built in commands are implemented in Smalltalk. Simple
Smalltalk expressions, followed by $!!, are evaluated as doIt commands.
All other commands are passed to process proxies to be executed externally.

CommandShell can open a terminal window in either Morphic or MVC.

UnixCommandSyntax implements command line parsing and file name globbing.
This allows direct execution of external commands without use of an external
command shell.

PipeableEvaluator evaluates Smalltalk expressions and provides a framework
for pipelines of expressions combining Smalltalk expressions with external
Unix commands. It behaves similarly to a ConnectedUnixProcess. Both the
shell builtin commands and doIt expression commands are implemented with
PipeableEvaluator.

CrLfFileEditor is a simple editor which can be used within command pipelines.
The 'edit' shell builtin creates an instance of CrLfFileEditor.

Try evaluating these expressions:
	CommandShell command: 'help'
	CommandShell open
	CommandShell command: 'ps -aef | edit'
	CommandShell command: 'edit /etc/hosts'
	CommandShell command: 'edit /etc/hosts; exit'
	CommandShell command: 'help | edit'
	CommandShell command: 'ps -aef | edit'
	CommandShell command: 'Time dateAndTimeNow! | edit; exit'
	CommandShell command: 'type type | inspect; exit'

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CommandShellV1-4.cs.gz
Type: application/x-gunzip
Size: 33617 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011122/7aa6e634/CommandShellV1-4.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CommandShell-menu-V1-4.cs.gz
Type: application/x-gunzip
Size: 1093 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011122/7aa6e634/CommandShell-menu-V1-4.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CommandShell-sUnit-V1-4.cs.gz
Type: application/x-gunzip
Size: 4005 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011122/7aa6e634/CommandShell-sUnit-V1-4.cs.bin


More information about the Squeak-dev mailing list