• broken pipe stdout

    From meshparts@alexandru.dadalau@meshparts.de to comp.lang.tcl on Mon Jan 19 19:17:49 2026
    From Newsgroup: comp.lang.tcl

    Hi there,

    What could cause this random error that I get in my Tcl/Tk app?

    error writting "stdout": broken pipe while executing "puts $args"

    Some background:

    In the main app I create multiple threads.
    I send to the different threads bysically the same command e.g.
    "batchcmd" with different parameters to be processed in parallel.

    The "batchcmd" command looks something like below.
    The "cmdline" variable is the call to the same app executable as the
    main app. So basically, the main app starts itself in different processes.

    Many thanks
    Alex

    proc batchcmd {args} {

    # Open different channels for read and write
    lassign [chan pipe] processStdin writeChanId
    lassign [chan pipe] readChanId processStdoutErr

    # React when the read channel becomes readable (meaning, a new line
    was written to the channel)
    chan event $readChanId readable "::meshparts::GeneratePartBatchRead $readChanId $processStdoutErr"
    # Start the part generation process
    set res [::twapi::create_process "" -cmdline $cmdline -returnhandles
    1 -inherithandles 1 -stdchannels [list $processStdin $processStdoutErr $processStdoutErr]]

    # Store the process handles
    lassign $res pid tid hproc hthread
    # Wait for the process to end
    set ::meshparts::twapi_pid($pid) ""
    ::twapi::wait_on_handle $hproc -executeonce 1 -async [list ::meshparts::GlobalVarSetFromTwapiCallback ::meshparts::twapi_pid($pid) ""]
    vwait ::meshparts::twapi_pid($pid)
    ::twapi::close_handle $hproc


    }


    --- Synchronet 3.21b-Linux NewsLink 1.2