Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: cec3ab2d316a852a112616a215ce23f7d1751ab9dcf5a516cbd2eb7431d7fcb4
Ticket: 91c9bc1c457fda269ae18595944fc3c2b54d961d
Standard channels (stdin, stdout, stderr) on Windows may get broken by dup2()
User & Date: sebres on 2018-11-12 08:51:44
Changes

  1. icomment:
    Hmm... Never saw this using tcl for win (in tcl-shell as well as in own binaries as library and even static linked).
    Furthermore although I can imagine the situation like this (theoretically), I don't understand how the suggested solution can fix that (excepting the case where standard handles are modified without notifying tcl about that).
    
    If the standard handle is altered (closed, reopened, whatever), is the duplication of this (for example closed) handle does not cause the same error?
    
    Or still another question - if the altering takes place hereafter (e.g. after initial call of <code>Tcl_GetStdChannel</code>), it is expected at all that the write/read will be done using "old" (unmodified) standard handles?
    
    It looks like a 3rd party issue to me - the OCCT (or dependencies) should simply call <code>Tcl_SetStdChannel</code> if it does change the standard handles.
    Or even using pair Tcl_Close/Tcl_CreateChannel for standard handles.
    See [https://www.tcl.tk/man/tcl8.6/TclLib/GetStdChan.htm|Tcl_GetStdChannel manual page - Tcl Library Procedures] for more info.
    
    Therefore the duplication as described as possible solution is rather a workaround, and may produce unexpected behavior resp. cause strange effects on other software (especially multi-threaded) that uses correctly rewrite or close handling of the standard channels.
    
  2. login: "sebres"
  3. mimetype: "text/x-fossil-wiki"
  4. resolution changed to: "Invalid"
  5. status changed to: "Pending"