Re: source question

From: Bob Techentin (techentin.robert_at_mayo.edu)
Date: 01/05/05


Date: Wed, 5 Jan 2005 07:34:14 -0600


"Vespasian" <julie.spicer@verizon.net> wrote
> How about without using the return? I can get the script name that
is
> currently executing using the 'info script' command. Once I have
that,
> I want to be able to kill the script that is currently executing at
> any point during the execution of that script.
>
> >> If you source in file (i.e. source filename), is there a way to
cancel
> >> out of the currently executing sourced file?

I think you might mean something like this:

  main.tcl
  --------
  ... some main commands
  source filea.tcl
  ... more main commands

  filea.tcl
  --------
  ... some filea commands
  source fileb.tcl
  ... more filea commands

And while you are executing fileb.tcl, some condition should stop
executing commands in fileb.tcl, and stop executing commands in
filea.tcl, so that "more filea commands" does not execute. But you
might want to continue the main program execution with "more main
commands."

If that is what you want to do, then of course you can do it. Just
call [error] in fileb.tcl, and it will unwind the program stack all
the way to the top. If you want to catch an error, then use "catch
{source filea.tcl}" in main.tcl, and you can continue with your main
program.

But that is a rather strange thing to do. A better style is to use
[source filename] mostly just to define procedures. Just put proc
definitions in your source files. Then leave the conditional
execution up to regular coding. Returning from or generating errors
while sourcing just isn't a Good Thing (tm).

Bob

-- 
Bob Techentin                   techentin.robert@NOSPAMmayo.edu
Mayo Foundation                                 (507) 538-5495
200 First St. SW                            FAX (507) 284-9171
Rochester MN, 55901  USA            http://www.mayo.edu/sppdg/


Relevant Pages

  • Re: Convert to lowercase and test for equality
    ... script produces a separate file for executing the rename commands. ... my goal is to rename a bunch files residing in a DOS based file system. ...
    (comp.unix.shell)
  • Re: Searching for Robust Download Automation
    ... to execute a command upon successful transfer. ... ad hoc methods for detecting corrupted/incomplete files, executing ... those commands, and cleaning out the transferred files. ... UUCP has done the things I list above for 20+ years, ...
    (comp.unix.shell)
  • Re: cmdlines.txt not executing
    ... I assume you have oempreinstall=yes in the unattended script since ... However nothing is executing. ... I can run the commands manually after the ...
    (microsoft.public.windowsxp.setup_deployment)
  • Makeinfo error when attempting to compile binutils-2.18 for AVR target
    ... I'm trying to compile the gnu avr toolchain on Fedora 7. ... config.status: executing depfiles commands ...
    (Fedora)
  • Re: remove user exe execute permission
    ... The only way I can think of to prevent a user from executing commands is to ... needs to be able to call CreateProcess* to successfully run CGI Scripts on ... >> full control under their IIS web folder to their files. ...
    (microsoft.public.windows.server.security)