Seach for Tcl Expect equivalent

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Seach for Tcl Expect equivalent

vicnet
Hello,

Expect is a librarie/tools in perl or Tcl that is aim to control a process. You could send command on the stdin and wait for answer on stdout, then react on this event (thant why it is call 'expect').

Uselfull for executable tests, or control an automatic telnet session ...

I know OSProcess to launch executable and play with stdin/stdout but it's not exactly what do Expect.


Do you know something like that on Pharo ?

a+
Vicnet
Reply | Threaded
Open this post in threaded view
|

Re: Seach for Tcl Expect equivalent

David T. Lewis
On Thu, Sep 17, 2009 at 05:32:36AM -0700, Vicnet wrote:

>
> Hello,
>
> Expect is a librarie/tools in perl or Tcl that is aim to control a process.
> You could send command on the stdin and wait for answer on stdout, then
> react on this event (thant why it is call 'expect').
>
> Uselfull for executable tests, or control an automatic telnet session ...
>
> I know OSProcess to launch executable and play with stdin/stdout but it's
> not exactly what do Expect.
>
>
> Do you know something like that on Pharo ?

I do not know of anything equivalent to Expect, but if you are using
OSProcess and CommandShell, then the scripting methods in CommandShell
such as #script:onFailureDo: and #if:then:else: may be of some interest.
There are examples in CommandShellTestCase in category "testing-scripts".
Basically it works like this:

        result := CommandShell new
                script: 'who
                                help
                                ls -l NOSUCHFILE
                                help'
                onFailureDo: [:p | 'the pipeline collection that failed was ', p printString].

or this:

        CommandShell new
                if: 'who
                        ls NOSUCHFILE
                        pwd'
                then: ['the script succeeded']
                else: ['the script failed']

Dave


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Seach for Tcl Expect equivalent

vicnet
Hello,

David T. Lewis wrote
> Expect is a librarie/tools in perl or Tcl that is aim to control a process.
I do not know of anything equivalent to Expect, but if you are using
OSProcess and CommandShell, then the scripting methods in CommandShell
such as #script:onFailureDo: and #if:then:else: may be of some interest.
You're right. Expect is something like that but with more possibilities on what an application could put on stdout.

Thanks for the idea.

a+
Vicnet
Reply | Threaded
Open this post in threaded view
|

Re: Seach for Tcl Expect equivalent

vicnet
In reply to this post by David T. Lewis
Hello,

David T. Lewis wrote
> Expect is a librarie/tools in perl or Tcl that is aim to control a process.
I do not know of anything equivalent to Expect, but if you are using
OSProcess and CommandShell, then the scripting methods in CommandShell
such as #script:onFailureDo: and #if:then:else: may be of some interest.
You're right. Expect is something like that but with more possibilities on what an application could put on stdout.

Thanks for the idea.

a+
Vicnet