Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a47170cc4f9aa6bb8b70a7e60f6d2844375bed1ad37c7d65c9e741b99345c786
Ticket: 0f1ddc0df7fb734cf1cba12ac7c529d29fefb842
exec fails on encoding errors present in the output of the executed command
User & Date: pointsman on 2023-11-27 20:07:27
Changes

  1. icomment:
    Perhaps the better workaround for the given example would be:
    <code>
    set fd [open |$cmd]
    fconfigure $fd -profile replace
    puts "ret:[read $fd]"
    </code>
    
    While it is true that exec is simple-minded wrt to the encoding of the stdin, stdout (and stderr) of the started process the core problem here are the changes in the I/O system of Tcl 9, especially TIP 657.
    
    Please note that this is an improvement. With Tcl 8.6 the code example provided by Paul show a wrong result without a chance that the programm / programmer is able to notice.
    
    But perhaps it would be better if exec would open the channels always with -profile replace. TIP 657 already has the exception of the glob command (and access to the env array). This would be another one, for reasons.
    
  2. login: "pointsman"
  3. mimetype: "text/x-markdown"