From: Junio C Hamano Date: Thu, 06 May 2021 23:37:49 GMT Subject: Re: [PATCH v1 1/8] compat/terminal: let prompt accept input from pipe Message-ID: In-Reply-To: <20210506165102.123739-2-firminmartin24@gmail.com> Firmin Martin writes: > Currently, git_prompt ignores input coming from anywhere other than > terminal (pipe, redirection etc.) meaning that standard prompt > auto-answering methods would have no effect: > > echo 'Y' | git ... > yes 'Y' | git ... > git ... > It also prevents git subcommands using git_prompt to be tested using > such methods. For testing, wouldn't lib-terminal.sh be usable for your purpose? If not, what is the reason why it is insufficient? Can we fix that instead? Allowing prompter to read from pipe has a big downside in the production code: you cannot pipe data into our command, and let it ask interactive questions from the end user by opening /dev/tty. > This patch fixes this issue by considering standard input when !isatty(0). > It also rearranges the control flow to close input and output file handlers. So this "fix" is probably very unwelcome, especially if done unconditionally. Thanks.