External processes from Squeak

Mark Guzdial guzdial at cc.gatech.edu
Tue Jul 30 19:34:41 UTC 2002


Has anyone tried this on OS X?  I'll try it in a bit, but thought I'd 
ask first.  (1 week away from email leads to hours digging out from 
under...)

Mark

On Sunday, July 28, 2002, at 07:49  AM, David T. Lewis wrote:

> On Sun, Jul 28, 2002 at 08:54:23AM +0200, Yoel Jacobsen wrote:
>>
>>     Is there a way to execute an external process from squeak and get
>> its input, output and error streams? (something like popen() )
>
> Assuming that you are using a Unix or Linux system, load the OSProcess
> (http://minnow.cc.gatech.edu/squeak/708) and CommandShell
> (http://minnow.cc.gatech.edu/squeak/1914) change sets.
>
> To run an external process with access to input/output/error streams:
>   | p |
>   p _ PipeableOSProcess command: 'ls -l * NONESUCH'.
>   p output inspect.
>   p errorUpToEnd inspect.
>
> or:
>   | p |
>   p _ PipeableOSProcess command: 'cat'.
>   p nextPutAll: 'hello world!'.
>   p close.
>   p output inspect.
>
> Note: PipeableOSProcess>>output will block on the pipe read, so be sure
> to do the #close.  See PipeableOSProcess>>upToEnd for a nonblocking 
> read.
>
> If you have recently downloaded Ian's Unix VM, the required plugin
> (UnixOSProcessPlugin.so) is already included, so just load the change
> sets and all should be well. Otherwise, source code for the plugin is
> included in the OSProcess change set.
>
> Dave
>
>




More information about the Squeak-dev mailing list