wduquette / tcl-quill

Build tool for Tcl/Tk projects
BSD 2-Clause "Simplified" License
10 stars 2 forks source link

exec, foreach and automatic list interpretation with backslahes bug #8

Closed effelsberg closed 10 years ago

effelsberg commented 10 years ago

At least in teapot.tcl I found some occurrences of such code (more places may exist):

foreach {code path} [exec $teacup link info $teapot] {
    . . . use |code| and |path|
}

Now the problem. What exec returns is a string like this:

Shell c:\tcl\bin\tclsh86.exe

When interpreted as a list like foreach does implicitly you'll get:

code: Shell
path: c:      cin     clsh86.exe

The gaps are tabs and the 'l' of 'tcl' has been eaten by a backspace.

I suggest you use proper splits (for newlines and then spaces) to separate the contents of what exec returns.

wduquette commented 10 years ago

Thank you! I'll look into it; it might be a little more involved since the path could contain spaces. I'll have to see what happens in that case.