[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.

Reply via email to