Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] newins "-" for standard input?
Date: Thu, 26 Mar 2009 01:07:27
Message-Id: 200903252107.24430.vapier@gentoo.org
In Reply to: Re: [gentoo-dev] newins "-" for standard input? by Alec Warner
1 On Monday 23 March 2009 13:01:46 Alec Warner wrote:
2 > On Mon, Mar 23, 2009 at 8:41 AM, Ulrich Mueller <ulm@g.o> wrote:
3 > >>>>>> On Mon, 23 Mar 2009, Ciaran McCreesh wrote:
4 > >>>
5 > >>> Now that "dosed" is going to be banned, what would people think of
6 > >>> "newins" (and the other "new*" commands) accepting "-" as the first
7 > >>> argument?
8 > >>
9 > >> There's a slightly different variation in exheres-0: as well as do*
10 > >> and new*, there's also here*, which you use like this:
11 > >>
12 > >> hereins foo <<'END'
13 > >> stuff
14 > >> END
15 > >
16 > > Why would we need a new command for this? The minus sign denoting
17 > > standard input is fairly common with other utilities.
18 > >
19 > >> It magically barfs, rather than hanging indefinitely, if you forget
20 > >> to give it some input.
21 > >
22 > > I guess the same could be done for "newins -", if you think that it is
23 > > necessary (test for stdin being a terminal?). But I don't really see
24 > > the point of it, since such a mistake would be noticed immediately
25 > > when testing the ebuild.
26 >
27 > No, they aren't 'noticed immediately'. The ebuild hangs and then the
28 > author spends 10 minutes trying to figure out why. If its trivial to
29 > implement..I don't see a downside to such a feature.
30
31 this "feature" can be found in any number of existing utilities. like sed.
32 any argument along those lines is pretty weak. using "-" as a shortcut name
33 for stdin sounds logical to me considering it's a standard in the *nix world.
34
35 as for the portage utils checking stdin and reporting an error if it's trying
36 to grab from the terminal, that's cheese someone can implement if they really
37 want it.
38 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature