[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1422706 - in /subversion/trunk/subversion: libsvn_subr/opt.c tests/cmdline/svntest/main.py

From: Peter Samuelson <peter_at_p12n.org>
Date: Mon, 17 Dec 2012 16:57:41 -0600

> On Mon, Dec 17, 2012 at 01:44:43PM -0600, Peter Samuelson wrote:
> > [Stefan Sperling]
> > > We could use iatty() to enable --non-interactive if output is not
> > > going to a terminal, for instance.
> >
> > I floated this idea some time ago and I'm still in favor of it. But I
> > think a simple isatty(STDERR_FILENO) would be wrong.

[Stefan Sperling]
> Why? Not all ttys are interactive of course. But I don't really care if
> people piping their line printers or modems into svn's stdin get interactive
> mode by default. Is there any other downside to using isatty()?
>
> And, actually, don't we want to check stdin, not stderr or stdout?

I wasn't objecting to isatty(), but to the idea that
isatty(STDERR_FILENO) would be sufficient. As you say, stdin is more
appropriate than stderr. But you _can_ have a situation where you are
on a tty but stdin is not. For example:

    # revert part of an import of a dirty working tree
    find . -name '*.obj' | xargs svn rm

(Perhaps 'svn rm' will not cause interactive prompting - for now - but
I hope you get the idea.)

Of course, so long as interactive prompts use stdin, isatty(STDIN_FILENO)
makes sense. But this sort of usage is why I think prompting should
instead use /dev/tty, for both input and output. And then if /dev/tty
cannot be opened, assume --non-interactive.

Peter
Received on 2012-12-17 23:58:45 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.