arguments to TclCreatePipeline cannot start with '|'
Pending1862356fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 6 days ago
Descriptionplain2008-01-02 18:42:46
Any parameter to TclCreatePipeline which begins with a pipe symbol triggers the 'command needed' case, even if it's not just a | or |&. This makes it impossible to pass any parameter to a child process which begins with a pipe symbol. The problem occurs on 8.4.13 but not on 8.4.7. I haven't checked other versions. Example: (Tcl 8.4.7) % exec echo |foo |foo (Tcl 8.4.13) % exec echo |foo illegal use of | or |& in command
Referenced by3
0c63a59973Fix [2339907fff] and [1862356fff], regressions from [47d7a23bdf] check-in2026-11-27 12:30:00236049772dTicket [2339907fff] execing command that starts with 2 fails status still Open with 4 other changes ticket2026-10-17 07:04:13622c092a53Fix [2339907fff] and [1862356fff], regressions from [47d7a23bdf]: in the first pass of TclCreatePipeline() a command word starting with "2" (but not "2>") was not counted as a command, and a word starting with "|" (but not "|" or "|&") was taken as a bar, so both gave "illegal use of | or |& in command". check-in2026-10-17 07:02:30
[email protected]plain2008-01-04 01:04:05
Logged In: NO works if you separate the "|" from foo % exec echo | foo or % exec echo |& foo (8.4.14)
dkfplain2008-01-04 05:18:09
Logged In: YES
user_id=79902
Originator: NO
Depends on what you mean "works".
Suggested workaround: I find that when things get tricky, it's better to do this:
exec sh -c {echo '|foo'}
And when I started using that trick for things exposed to users, my users got happier too; they prefer Unix shell syntax to Tcl's [exec] syntax. On windows, you can do something similar, possibly with the help of a batch script.
serhiy.storchakawiki2026-10-17 07:04:13
Regression since 8.4.13 from [47d7a23bdf] (the fix for [768659]): the first pass of TclCreatePipeline() takes any word starting with "|" for a bar, although only "|" and "|&" are, so [exec echo |foo] fails with "illegal use of | or |& in command". Proposed fix in branch exec-pipeline-words, tests exec-23.2 and exec-23.3. It also fixes [2339907fff].
jan.nijtmans Pending ticket [1862356fff].
[History diff]2026-11-27 12:26:59
jan.nijtmanswiki2026-11-27 15:28:18
Merged to [trunk]
Log in (anonymous is fine) to add a comment.