About using squeak to script...

David T. Lewis lewis at mail.msen.com
Sat Aug 12 13:53:44 UTC 2006


On Sat, Aug 12, 2006 at 10:38:14AM +0200, st?phane ducasse wrote:
> Hi
> 
> I would like to use I would like to pass a file as argument, I know  
> that this is possible
> and I should read the manual. ;) any hints is welcome.
> 
> What I do not know is how can I print on stdoutput?
> Should I create a primitive (argh) for that?
> Would be neat to have that per default (may be this is the time for  
> me to learn something new writing
> a primitive)
 
Hi Stef,

I'm not sure what you mean by "using Squeak to script", but did you
have in mind something like the following in CommandShell:

script: aScriptString onFailureDo: aBlockWithOneParameter
  "A script is a String containing a list of commands separated
  by Character cr. Evaluate each command in aScriptString until
  a failure is encountered. On failure, answer the result of
  evaluating aBlockWithOneParameter with the last proxy to have
  been evaluated as its parameter. Otherwise, answer the last
  process proxy to have been evaluated."

  "CommandShell new open; 
    script: 'who
        help
        ls -l NOSUCHFILE
        help'
    onFailureDo: [:p | 'the proxy that failed was ', p printString]"





More information about the Squeak-dev mailing list