From: TRINH Minh Hieu (mhtrinh_at_gmail.com)
Date: Tue Oct 12 2010 - 02:20:19 CDT

Hi,

On Mon, Oct 11, 2010 at 4:23 PM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:

> On Mon, Oct 11, 2010 at 8:34 AM, TRINH Minh Hieu <mhtrinh_at_gmail.com>
> wrote:
> >
> > Hi,
> >
> > I used tcl script to build movie with VMD 1.8.7.
> > On the previous version 1.8.6, after a "source" (eg source myscript.tcl)
> > command, I can stop the sourcing with a Ctrl+C and it give me back the
> > control "vmd >"
> > On the current version 1.8.7, whenenver I make a Ctrl+C, it kills the
> whole
> > VMD :-(.
>
> the latter would, in fact, be the expected behavior.
> if you want to change this, you would have to
> program a "signal handler" that traps this signal
> and then does something meaningful. to do this
> in the middle of script execution would make
> VMD return to a somewhat undefined state. i am
> not sure if this would be good.

> > How can I kill just a "child process" in vmd ? Is there a special option
> to
> > add when invoking vmd ?
>
> a script is _not_ a child process. you would have to
> write your script in a way that it is interruptible, i.e. that
> it checks the keyboard for input and that it runs the
> event handler to trap this input.
>

As complete beginner in Tcl/Tk, I found work around like you suggest :
In my process that update regularly the display, I put :

    if {[file exist $stopfilename]==1} {
         error "Script Cancelled by User"
     }

When I need to stop my sourcing, in another console, I "touch" a "stop"
file. It not very clean but it works :-)
Thank you for your help.
Cheers,

    mhtrinh