[ENH][GOODIE] OSProcess V2.5 (version 2.5 released)
David T. Lewis
lewis at mail.msen.com
Thu Nov 22 14:56:17 UTC 2001
OSProcess 2.5
Previous released version: 2.4
Corresponding CommandShell version: 1.4
Solaris VM builders please see "known bugs" below
OSProcess provides access to the external operating system from Squeak.
A plugin is provided for Unix (and Linux) systems. OSProcess can be
loaded on any platform, and placeholder classes are provided in the
OSProcess hierarchy for other operating systems (Windows, Mac, OS/2,
RiscOS), but support for these systems is not yet implemented.
You can:
- Open a inspector on the operating system process in which
Squeak is running (OSProcess thisOSProcess).
- Read or write on the stdin, stdout, and stderr streams.
- Access the command line, and get or set environment variables.
- Fork and exec external programs, with control of the command
line, environment, and stdin/stdout/stderr.
- Open an inspector on a child operating system process created
from Squeak, with run state and exit status of the child updated
asynchronously.
- Run an external command:
OSProcess command: 'xeyes'
- Connect directly to input and outputs of external commands:
(ConnectedUnixProcess command: 'ls -l *') output
- Create pipes and connect them to external processes.
- Execute external command pipelines from Squeak:
((ConnectedUnixProcess command: 'ps') | 'grep squeak' | 'cut -c16-100') output
- Fork an exact clone of the current running Squeak image (no
image file) with parent and child Squeak processes proceeding
from the same point in memory (UnixProcess forkSqueak).
- Fork a Squeak using the disk based image (UnixProcess squeak).
- Start a headless Squeak from the running Squeak image, giving
it an expression to evaluate:
(UnixProcess forkHeadlessSqueakAndDoThenQuit:
[UnixProcess command: 'echo hello world'])
- Tell the running image to go headless (UnixProcess decapitate), and
reconnected the image with a window (UnixProcess recapitate).
- Move the display to another computer on the network:
(UnixProcess displayOnXServer: 'someOtherComputer')
- Restart the VM on the fly (UnixProcess restartVirtualMachine).
- Rebuild the VM, and restart Squeak with the new VM if the
build was successful (UnixProcess makeVM).
- Start your Swiki in a headless background process:
(UnixProcess startSwiki: 'myswiki' onPort: 8081 loggingTo: 'log.txt')
OSProcessV2-5.cs is the main change set for OSProcess.
OSProcess-sUnit-V2-5.cs contains SUnit tests (not required).
See the separate CommandShell change set for a Unix shell window
which uses OSProcess.
The classes in OSProcess are:
Object
OSProcess
ExternalOSProcess
ExternalMacOSProcess
ExternalOS2Process
ExternalRiscOSProcess
ExternalUnixProcess
ConnectedUnixProcess
ExternalWindowsOSProcess
ThisOSProcess
MacProcess
OS2Process
RiscOSProcess
UnixProcess
WindowsProcess
Stream
OSPipe
InternalPipe
OSProcessAccessor
MacOSProcessAccessor
OS2OSProcessAccessor
RiscOSProcessAccessor
UnixOSProcessAccessor
WindowsOSProcessAccessor
InterpreterPlugin
UnixOSProcessPlugin
UnixOSProcessPluginDynamicThisSession
UnixOSProcessPluginInterpreterGetThisSession
UnixOSProcessPluginStaticThisSession
Known bugs in 2.5:
- Forking a child Squeak, as in UnixProcess>>forkSqueak, results in two
instances of Squeak which share a single changes file. This has no
practical impact if one or the other of the Squeak processes exits without
doing very much, but it would probably result in a corrupted changes
file if both Squeak instances do a lot of changes. I am leaving this as
is for now, since a quick fix would require one of the Squeaks to
save itself under an different image name.
- The connectToXDisplay method is probably dangerous from a security
perspective.
- UnixOSProcessAccessor>>primitiveEnsetEnv uses the function unsetenv(),
which is not available on Solaris (and possibly other systems). I do not
know the portable equivalent of unsetenv(), so for now Solaris users
will need to comment out the call to unsetenv() and rebuild the plugin.
Other than failing the SUnit tests, commenting the function out has
little practical impact.
Changes in 2.5 since 2.4:
- Added concrete subclasses of UnixOSProcessPlugin. This allows the plugin
to be built with several flavors of FilePlugin which implement session
identification in different ways.
- Fixed ConnectedUnixProcess #next: and #next to handle nil streams.
- Moved InternalPipe into Base (was in CommandShell). The class currently
appears in both OSProcess and CommandWindow (this should be fixed).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OSProcessV2-5.cs.gz
Type: application/x-gunzip
Size: 60706 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011122/0f88dcde/OSProcessV2-5.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OSProcess-sUnit-V2-5.cs.gz
Type: application/x-gunzip
Size: 4399 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011122/0f88dcde/OSProcess-sUnit-V2-5.cs.bin
More information about the Squeak-dev
mailing list
|