[ENH][GOODIE] OSProcess V3.0 (OSProcess for Windows)
David T. Lewis
lewis at mail.msen.com
Tue Mar 12 02:16:30 UTC 2002
OSProcess 3.0
David T. Lewis, 10 March 2002
Previous released version: OSProcess 2.7
Corresponding CommandShell version: 3.0
This is the first Windows release.
Windows users please see 'Known bugs' below.
Version numbers for OSProcess, CommandShell, and all plugins have
been set to 3.0 for this release.
See the separate CommandShell change set for a Unix shell window
which uses OSProcess.
OSProcess provides access to the external operating system from Squeak.
Plugins are provided for Unix, Linux, and Windows systems. OSProcess
can be loaded on other platforms as well, and placeholder classes are
provided in the OSProcess hierarchy for other operating systems (Mac,
OS/2, RiscOS), although 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 (Unix only
for this release).
- Access the command line, and get or set environment variables
(Windows: get environment only).
- Fork and exec external programs, with control of the command
line, environment, and stdin/stdout/stderr (Windows: run an
external program).
- 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' (Unix)
OSProcess command: 'sol' (Windows)
- Connect directly to input and outputs of external commands. See
the separate CommandShell change set for a useful implementation,
supporting commands like:
(PipeableOSProcess command: 'ls -l *') output
- Create pipes and connect them to external processes (see the
CommandShell change set).
- 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')
Known bugs in 3.0:
- On Windows, OSPipe is implemented, but an OSPipe cannot yet be set
for nonBlocking reads or writes. Reading from an OSPipe with no data
available will block the Squeak VM (<ctl><alt><del> required!!).
- On Windows, stdin/stdout/stderr access is not yet implemented.
- On Windows, command pipelines for external commands are not yet
implemented. CommandShell does work, and may be used for launching
individual Windows programs as well as for the usual CommandShell
internal commands and internal command pipelines. However, it is
not yet possible to construct a pipeline of Windows programs.
- 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 3.0 since 2.7:
- Added support for Windows. Windows programs can be launched. Squeak
keeps track of its external programs and updates their runState and
exitStatus.
- Added a plugin for Windows. The plugin can run external Win32 programs,
and provides notification to Squeak when an external process exits. It
can create an OSPipe (but see bug notes above). Functions required for
command pipelines and nonblocking pipes are not yet implemented.
- Refactored the plugin classes to share code between Unix and Windows
where possible.
- Added WindowsThread to represent an OS thread of execution within an
OS process. This may be generalized for other platforms as required (eg
pthread support on Unix).
- Did a general refactoring and renaming of classes to incorporate Windows
support. Most importantly, class ConnectedUnixProcess has been replaced
by class PipeableOSProcess in the separate CommandShell change set.
PipeableOSProcess is platform independent, and collaborates with platform
specific instances of ExternalOSProcess to eliminate the need for separate
'connectable' subclasses for each platform.
The classes in OSProcess are:
OSProcess
ExternalOSProcess
ExternalMacOSProcess
ExternalOS2Process
ExternalRiscOSProcess
ExternalUnixOSProcess
ExternalWindowsOSProcess
ThisOSProcess
MacProcess
OS2Process
RiscOSProcess
UnixProcess
WindowsProcess
WindowsThread
OSPipe
(StandardFileStream)
AttachableFileStream
OSProcessAccessor
MacOSProcessAccessor
OS2OSProcessAccessor
RiscOSProcessAccessor
UnixOSProcessAccessor
WindowsOSProcessAccessor
(InterpreterPlugin)
OSProcessPlugin
UnixOSProcessPlugin
UnixOSProcessPluginDynamicThisSession
UnixOSProcessPluginInterpreterGetThisSession
UnixOSProcessPluginNoThisSessionAvailable
UnixOSProcessPluginStaticThisSession
Win32OSProcessPlugin
Win32OSProcessPluginDynamicThisSession
Win32OSProcessPluginInterpreterGetThisSession
Win32OSProcessPluginNoThisSessionAvailable
Win32OSProcessPluginStaticThisSession
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OSProcessV3-0-dtl.cs.gz
Type: application/x-gunzip
Size: 66370 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020311/b3a51832/OSProcessV3-0-dtl.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OSProcess-sUnitV3-0-dtl.cs.gz
Type: application/x-gunzip
Size: 5345 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020311/b3a51832/OSProcess-sUnitV3-0-dtl.cs.bin
More information about the Squeak-dev
mailing list
|