On 17.12.2012 20:44, 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. What you want is
> to detect that there is a controlling terminal at all - something like:
>
> #if WINDOWS
> #define CON "CON:"
> #else
> #define CON "/dev/tty"
> #endif
> fd = open(CON, O_RDWR);
> if (fd >= 0) {
> close(fd);
> ...
> }
>
> (Of course I have no idea if "CON:" behaves that way. But there must
> be _some_ way to determine, on Windows, whether you have a terminal
> window available.)
>
> Someone - was it Mark, perhaps? - objected to this idea on the basis
> that some wrapper programs out there may try to "scrape" the prompts,
> in interactive mode, and supply the correct input from, e.g., GUI
> dialog boxes.
>
> I feel like that's a blatant abuse of our interfaces and we shouldn't
> support it, and if anyone really needs to do that they should use
> 'expect', but that's just an opinion and it isn't (yet) backed with any
> code.
That "blatant abuse" happens at least in two places that I'm aware of:
our tests, and Emacs vc-mode.
And we'd hardly go to the trouble of keeping the command-line output
backwards-compatible if we didn't /expect/ people to drive svn this way.
-- Brane
--
Branko Čibej
Director of Subversion | WANdisco | www.wandisco.com
Received on 2012-12-17 21:15:17 CET