Menu

#492 Gripes about pipes

final: 8.0.5
closed-fixed
nobody
2
2001-03-31
2000-10-26
Anonymous
No

OriginalBugID: 3985 RFE
Version: 8.0.5
SubmitDate: '2000-01-06'
LastModified: '2000-01-10'
Severity: MED
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: Solaris
FixedDate: '2000-10-25'
ClosedDate: '2000-01-10'

Name:
Krzysztof Kozminski

DesiredBehavior:
Did anyone ever complain that Tcl pipes don't work very well with
processes that pass out some of their output via exit status, such
as the unix 'diff' command?

I find this example rather annoying:

% open [list | diff $file1 $file2 | wc]
file7
% read file7
639 3230 19434

% close file7
child process exited abnormally

There is nothing abnormal here; diff exits with status 1 if it
finds differences. Presently, I have to do some ridiculous
convolutions like:

% open [list | /bin/sh -c "diff '$file1' '$file2';exit 0" | wc]

which work fine until I have a filename with funny characters
in it. Tcl pipe is much nicer in enabling me to work with
arbitrary filenames.

It would be nice to have some control over what exit status
is considered abnormal. Perhaps something like:

pid fileId pIndex -exitok expression

where pIndex would be the address of the process in the pipe,
and expression would be a Tcl expression in which '#' would
stand for the exit status.

In my example, I would do:

% open "| diff .cshrc .login | wc"
% pid file7 0 {(# == 0) == (# == 1)}

Or maybe 'close' should return a list of exit status values for
the user to decide whether they were abnormal or not. Something
like:

% close file7 -getexits
1 0

This RFE wants to allow for !0 exit codes to be considered
"normal" exits, which goes against the grain of Tcl and the
de facto standard for exit status. We understand that there
are a few commands in Unix which return !0 after "normal"
execution, but these can still be handled, and as special
cases should be.
-- 01/10/2000 hobbs

Discussion

  • Brent B. Welch

    Brent B. Welch - 2000-10-26
    • priority: 5 --> 2
    • status: open --> closed-fixed
     
  • Don Porter

    Don Porter - 2001-03-31
    • labels: 104250 --> 27. Channel Types