a trivial and complicated problem in TCL

Liste des GroupesRevenir à cl tcl 
Sujet : a trivial and complicated problem in TCL
De : aotto1968 (at) *nospam* t-online.de (aotto1968)
Groupes : comp.lang.tcl
Date : 12. Aug 2024, 13:45:39
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v9d05j$39sk8$1@dont-email.me>
User-Agent : Mozilla Thunderbird
Hi,
I use
 > pkg_mkIndex -verbose . {*}$libs
to build a 'pkgIndex.tcl' file … GOOD
NOW I want to redirect the "stderr" output (-verbose) to stdout ... BAD
I can't figure out a "trivial" solution for this simple task IN tcl.
I know there are "exec/open" etc command there I can redirect the output of an EXTERNAL program
but this is not for a tcl INTERNAL "proc" like "pkg_mkIndex".
I know that I can start an second tclsh with the "pkg_mkIndex" and redirect the output BUT
I search for an tcl INTERNAL solution.
my CURRENT solution is way-to-over-engineerd
→ recreate the tcl "put" command and exchange "stderr" with "stdout"
=========================================
# ERASE "stderr" from tcl output
rename puts __tcl__puts
proc puts {args} {
   set nxt [lindex $args 0]
   if {[string index $nxt 0] eq "-"} {
     set nnl $nxt
     set args [lassign $args -]
   } else {
     set nnl ""
   }
   set nxt [lindex $args 0]
   if {[llength [chan names $nxt]]} {
     if {$nxt eq "stderr"} {
       set chn stdout
     } else {
       set chn $nxt
     }
     set args [lassign $args -]
   } else {
     set chn ""
   }
   __tcl__puts {*}[concat $nnl $chn $args]
}
=======================================
What I look for is something like:
 > chan redirect /dev/stderr /dev/stdout
which works without touching any TCL related "proc" stuff or
spawn an extra shell.
→ any idea ?

Date Sujet#  Auteur
12 Aug 24 * a trivial and complicated problem in TCL3aotto1968
12 Aug 24 +- Re: a trivial and complicated problem in TCL1Ralf Fassel
12 Aug 24 `- Re: a trivial and complicated problem in TCL1undroidwish

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal