Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b57b50b9d0fd45b94eabba72e2c98595e7b783ce1455299d9093db1531d63ef1
Ticket: fb2fa9b3f6467ee66f543ec904e37aa8508f2fb1
exec broken for command having windows environment variables
User & Date: juliannoble2 on 2023-10-27 19:32:10
Changes

  1. icomment:
    Another way around this is to use powershell or sh (e.g from msys2)
    For example - sometimes you want things like an unbalanced quote to go through.
    That seems to be impossible with cmd.exe.  I had always thought this was a quirk of cmd - but now I suspect it's exec (which apparently has been interfering like this for a long time).  I have not noticed such interference on other platforms.
    
    I don't know how pwsh and sh are bypassing both the double quote escaping and the % escapes - (perhaps something to do with applType?) but however it happens I hope this behaviour in exec can be preserved and better yet - enabled in some way for cmd and batch files.  ( -nomolestation flag?)
    
    
        % pwsh -nop -nolo -c cmd.exe /c echo '%CD%unbalancedquote"'
        C:\tcl9b\binunbalancedquote"
        %
        % sh -c {echo unbalancedquote\"}
        unbalancedquote"
        %
        % cmd.exe /c echo {%CD%unbalancedquote"}
        "%"CD"%"unbalancedquote\"
    
    
    Note that calling cmd.exe from powershell brings another level of quoting quirks as you need to use powershell rules to single quote some things. sh also has different rules regarding quotes.
    This way madness lies - I'd really like the power to call things (everything) directly from Tcl in a way that can be reasoned about sanely.
    
  2. login: "juliannoble2"
  3. mimetype: "text/plain"