Subject: bug#6323: Enhancement request: Add wronly to Coreutils

From: Eric Blake <[email-masked]>
Date: Tue, 01 Jun 2010 09:56:38 -0600

On 06/01/2010 05:59 AM, Daniel Trebbien wrote:
> Over the past few days I have been working on a new Linux command-line
> utility which I'm calling `wronly` (https://launchpad.net/wronly).
> Basically what it does is copy its standard input to a file that is
> specified on the command line, but also closes its standard out and
> standard error if parsing of the command line options succeeds. It
> also supports a `--no-follow` option, the code for which I'm pretty
> proud of.

Would you mind showing actual command line examples of how you envision
using this?

> 
> I am aware of the similar `tee` program that is already part of GNU
> Coreutils, but I did not think that it would be wise for me to write a
> patch for `tee` that just causes `tee` to similarly close its standard
> error. I needed a program like `tee` that would close the standard
> error stream, so I figured that there might be uses if such a program
> were to close standard out as well. Of course, closing standard out in
> `tee` would fundamentally break the utility, but I'm also not sure if
> closing standard error in `tee` would cause problems for existing
> scripts that depend on it.

Actually, there's nothing wrong with patching tee to add another command
line option, if it really does make sense to add this functionality.
But right now, without a demonstration of why this is needed, and why:

cmd | tee file >&- 2>&-

does not already do what you want, it's hard to make any decisions.

> so, I would be more than happy to work with maintainers to integrate
> it into the Coreutils build process, standardize its source, and even
> attempt to write a Windows port.

Actually, the mere act of getting a patch into coreutils is sufficient
for writing a windows port, since the cygwin project is pretty reliable
at porting coreutils to windows.

-- 
Eric Blake   [email-masked]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org