Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-23
02:42 • Ticket [218814ffff] Redirection to NUL: broken status still Closed with 3 ot... artifact: a79639fdd3 user: dgp
2000-10-26
08:29 • Closed ticket [218814ffff]. artifact: 6606aecfae user: welch
01:05 • New ticket [218814ffff]. artifact: 9c4f2655eb user: nobody

Redirection to NUL: broken

Closed / Fixed218814ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:05:54
OriginalBugID: 2209 Bug
Version: 8.1.1
SubmitDate: '1999-06-15'
LastModified: '1999-07-29'
Severity: CRIT
Status: Released
Submitter: techsupp
ChangedBy: redman
OS: Windows 95
Machine: X86
FixedDate: '1999-07-29'
FixedInVersion: 8.2b2
ClosedDate: '2000-10-25'


Name:
Don Porter

Comments:
Has anyone else figured out a workaround for this?
    All my attempts so far have failed.

ReproducibleScript:
# FILE: demo.tcl
    puts stdout "msg to stdout"
    puts stderr "msg to stderr"

ObservedBehavior:
1. Tcl 8.1.1 on Linux/Alpha
    $ tclsh8.1
    % info patchlevel
    8.1.1
    % catch {exec tclsh8.1 demo.tcl} res
    1
    % set res
    msg to stdout
    msg to stderr
    % catch {exec tclsh8.1 demo.tcl > /dev/null} res
    1
    % set res
    msg to stderr
    % catch {exec tclsh8.1 demo.tcl >& /dev/null} res
    0
    
    Good -- that's what I want.
    
    2. Tcl 8.0.5 on Windows95
    C:\> tclsh80
    % info patchlevel
    8.0.5
    % catch {exec tclsh80 demo.tcl} res
    1
    % set res
    msg to stdout
    msg to stderr
    % catch {exec tclsh80 demo.tcl > NUL:} res
    1
    % set res
    msg to stderr
    % catch {exec tclsh80 demo.tcl >& NUL:} res
    0
    
    Excellent!  With proper substitutions for the names
    of the shell and the null device, I have cross-platform
    redirection to a /dev/null equivalent!
    
    Now enter the evil villain... Tcl 8.1 for Windows!
    
    3. Tcl 8.1.1 on Windows95
    % info patchlevel
    8.1.1
    % catch {exec tclsh81 demo.tcl} res
    1
    % set res
    msg to stdout
    msg to stderr
    % catch {exec tclsh81 demo.tcl > NUL:} res
    1
    % set res
    can not find channel named "stdout"
        while executing
    "puts stdout "msg to stdout""
        (file "demo.tcl" line 2)
    % catch {exec tclsh81 demo.tcl >& NUL:} res
    1
    % set res
    child process exited abnormally
    % set errorCode
    CHILDSTATUS -1 1

DesiredBehavior:
What happened?!
    
    I want a cross-platform way to redirect stdout/stderr of 
    a command pipeline to (the equivalent of) /dev/null.  I
    had it, and you took it away!  Give it back, or
    give me another way.



Allow tcl to use CHAR and UNKNOWN file types even for std channels. 
-- 07/29/1999 redman
welch Closed ticket [218814ffff]. [History diff]2000-10-26 08:29:16
dgp Ticket [218814ffff]: 3 changes [History diff]2001-04-23 02:42:22
Log in (anonymous is fine) to add a comment.