Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d9c873ecad91008bd5e92ad96dac048a4828367d25369efe83c616fff2743ee4
Ticket: f91ab723f3dfbc0d2b720a70a1fa09eebfa1cde5
exec+wish fails to handle windows batch file with arguments and spaces
User & Date: serhiy.storchaka on 2026-10-14 14:58:45
Changes

  1. icomment:
    I tested both branches (applied to the current core-8-6-branch) on Windows 11, with wish and tclsh.
    
    <b>bug-f91ab723f3-no-cmd</b> fixes the quoting, but breaks batch files in wish: without the hidden console of cmd.exe, console programs run from the batch file get their own consoles, so their output is lost, and <tt>ping ... | findstr ...</tt> in the batch file hangs.
    
    <b>bug-f91ab723f3-quoting</b> has the right idea, but the closing quote was appended after BuildCommandLine() converted cmdLine to WCHAR, so a single byte was added to a wide string: the command line got garbage at the end (e.g. <tt>test.bat"A</tt>, <tt>8?u</tt>), and many calls failed.
    
    I committed a fix on top of it, in the same branch [/timeline?r=bug-f91ab723f3-quoting|bug-f91ab723f3-quoting] (which is against 8.6): [30bc26a91e] appends the quote in BuildCommandLine() before the conversion. With it all cases work in wish as in tclsh: spaces in the path, <code>""</code>, arguments with spaces, &amp; | ^ !, embedded quotes, .cmd files, exit status, stdin, console programs and pipelines in the batch file. winPipe.test and exec.test pass.
    
  2. login: "serhiy.storchaka"
  3. mimetype: "text/x-fossil-wiki"