Re: exec problems
From: Michael Schlenker (schlenk_at_uni-oldenburg.de)
Date: 05/18/04
- Next message: Jeff Godfrey: "regexp advice"
- Previous message: Keith Vetter: "Re: Teaching [canvas]"
- In reply to: Murrgon: "Re: exec problems"
- Next in thread: Murrgon: "Re: exec problems"
- Reply: Murrgon: "Re: exec problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 18 May 2004 17:52:07 +0200
Murrgon wrote:
> Michael Schlenker wrote:
>
>> Actually Tcl is quite good at what you want, especially with expect
>> available, but in general the problem isn't super trivial.
>>
>> Perhaps you should take a look at tkCVS to get a hint how it is done
>> correctly:
>> http://wiki.tcl.tk/tkcvs
>
>
> Well, I took a look at tkcvs and I'd have to say that it is
> fairly elaborate. It was difficult to track down exactly
> where they were running the cvs commands but I found this
> section in the exec.tcl source file:
>
> set procout [open "| $command 2>@$procerr" r]
> set procid [pid $procout]
>
> fileevent $procout readable [list \
> [namespace current]::out_handler $viewer $filter]
> flush $procerr
> fileevent $procerr readable [list [namespace current]::err_handler]
>
> vwait [namespace current]::ExecDone
>
> If I understand this correctly (and I'm not sure that I do), they
> are using 'open' to exectute the CVS command and using 'fileevent'
> to watch for and handle the output from the command. This seems
> way more complicated than it needs to be.
This is a typical pipe setup for tcl (rather complex looking due to the
[namespace] and [list] quoting they do).
If you just want to exec a cvs command like cvs update and do not need
to have a user enter data interactivly to the program this is total
overkill. The big benefit of this is that you can display data as it
gets output by cvs and do not experience hangs of your GUI, not only
when the whole command has finished. And you would in principle be able
to feed input into the command. (not done in the above setting, so you
may have found the typical cvs invocation, but not the login.)
Could be that you simply want bgexec from the BLT package.
> I may end up switching
> to Python if this ends up being more trouble than it's worth.
How does using Python make this any easier (unless you know Python well
already and do not know Tcl)?
Michael
- Next message: Jeff Godfrey: "regexp advice"
- Previous message: Keith Vetter: "Re: Teaching [canvas]"
- In reply to: Murrgon: "Re: exec problems"
- Next in thread: Murrgon: "Re: exec problems"
- Reply: Murrgon: "Re: exec problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|