From: Jason S on
Hello,

I've run into an interesting problem that I've been unable to
workaround as of yet.

The following code results in / being converted to \ at execution time

set buildCommand {msbuild /t:setup}
exec $buildCommand

TCL is apparently trying to execute msbuild \t:setup for some reason.

However

exec {msbuild /t:setup} works fine so it seems to only occur when the
command is stored in a variable.

I'm writing a tool that assists in building a complex project so the
build command needs to be dynamically generated.

Any help is appreciated.

Jason
From: Gerald W. Lester on
Jason S wrote:
> Hello,
>
> I've run into an interesting problem that I've been unable to
> workaround as of yet.
>
> The following code results in / being converted to \ at execution time
>
> set buildCommand {msbuild /t:setup}
> exec $buildCommand
>
> TCL is apparently trying to execute msbuild \t:setup for some reason.
>
> However
>
> exec {msbuild /t:setup} works fine

I find that very unlikely.

The first argument to exec is the name of the executable, then it takes each
of the following arguments as an argument to the executable.

> so it seems to only occur when the
> command is stored in a variable.
>
> I'm writing a tool that assists in building a complex project so the
> build command needs to be dynamically generated.
>
> Any help is appreciated.
>
> Jason

To answer your question, try: eval exec $buildCommand


--
+------------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald.Lester(a)kng-consulting.net |
+------------------------------------------------------------------------+
From: Jason S on

>
> To answer your question, try: eval exec $buildCommand
>
Thanks that solved it!
From: Robert Heller on
At Tue, 13 Jul 2010 08:50:48 -0700 (PDT) Jason S <kompilersan(a)gmail.com> wrote:

>
> Hello,
>
> I've run into an interesting problem that I've been unable to
> workaround as of yet.
>
> The following code results in / being converted to \ at execution time
>
> set buildCommand {msbuild /t:setup}
> exec $buildCommand

This is really wrong. Exec does NOT take a single argument. It thinks
you want to exec a program named t:setup in a directory named 'msbuild '.

You should note what happens when you do this:

eval exec $buildCommand

>
> TCL is apparently trying to execute msbuild \t:setup for some reason.
>
> However
>
> exec {msbuild /t:setup} works fine so it seems to only occur when the
> command is stored in a variable.
>
> I'm writing a tool that assists in building a complex project so the
> build command needs to be dynamically generated.
>
> Any help is appreciated.
>
> Jason
>

--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller(a)deepsoft.com -- Contract Programming: C/C++, Tcl/Tk


From: Jeremy on
What I've always done was build my command line:

set cmd [list abc.exe /a]
if {$verbose} {
lappend cmd /verbose
}

exec {*}$cmd

Jeremy
http://www.kb8lfa.com

On Jul 13, 11:50 am, Jason S <kompiler...(a)gmail.com> wrote:
> Hello,
>
> I've run into an interesting problem that I've been unable to
> workaround as of yet.
>
> The following code results in / being converted to \ at execution time
>
> set buildCommand {msbuild /t:setup}
> exec $buildCommand
>
> TCL is apparently trying to execute msbuild \t:setup for some reason.
>
> However
>
> exec {msbuild /t:setup} works fine so it seems to only occur when the
> command is stored in a variable.
>
> I'm writing a tool that assists in building a complex project so the
> build command needs to be dynamically generated.
>
> Any help is appreciated.
>
> Jason