Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: [PATCH v3 1/2] add interface for /dev/tty interaction

From: Jeff King <hidden>
Date: 2016-06-15 22:54:26

On Sun, Aug 05, 2012 at 01:11:47PM -0700, Junio C Hamano wrote:
Tay Ray Chuan [off-list ref] writes:
quoted
Factor out the opening and closing of /dev/tty from
git_terminal_prompt(), so that callers may first test if a controlling
terminal is available before proceeding with prompting proper.

When HAVE_DEV_TTY is not defined, terminal_open() falls back to checking
tty-ness of stdin and stderr, as getpass() uses them both.

Signed-off-by: Tay Ray Chuan <redacted>
---
This is not your fault but seeing term_t made me go "eek, yuck".
Agreed.
As far as I can see, use of "FILE *" in existing compat/terminal.c
is not buying us anything useful.  The stdio calls made on FILE *fh
are only fopen(), fputs(), fflush() and fclose(), and everything
else goes through fileno(fh).

So perhaps it is a saner approach to fix that function first before
this patch so that it works on file descriptors.
Yeah, I think that is a good path. I think my original use of stdio
was mostly because I started by paring down glibc's implementation of
getpass.  Since we have niceties like write_in_full, I don't think
there's any reason not to just skip stdio.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help