From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 1457D1F5AE for ; Thu, 6 May 2021 23:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232789AbhEFXix (ORCPT ); Thu, 6 May 2021 19:38:53 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:62682 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232800AbhEFXiw (ORCPT ); Thu, 6 May 2021 19:38:52 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 3CBD6C654A; Thu, 6 May 2021 19:37:50 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=PyGrCxaPDa7kaW5l3MjiN1ziryBLn6pORfa9Te 4zdew=; b=AWcpv8DsXP3N/LKeQKjznk0hY9L4oyGdlZNopB+ewGsAbxnapc2RF8 5lddOpb4egzret9T7lO4Lw2gUU6IMqfVr0Bd6DB7s+Sji+2hyQBI8T3ZO8RNYlnT qnxD3mJXeh+VxjI/ADSKOPdy3M/33Qhkrp7cVRzioCFgwiIiQSZPk= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 33C66C6549; Thu, 6 May 2021 19:37:50 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.74.119.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id B9EE1C6540; Thu, 6 May 2021 19:37:49 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Firmin Martin Cc: git@vger.kernel.org, Jeff King , Johannes Schindelin , Erik Faye-Lund , Denton Liu Subject: Re: [PATCH v1 1/8] compat/terminal: let prompt accept input from pipe References: <20210506165102.123739-1-firminmartin24@gmail.com> <20210506165102.123739-2-firminmartin24@gmail.com> Date: Fri, 07 May 2021 08:37:49 +0900 In-Reply-To: <20210506165102.123739-2-firminmartin24@gmail.com> (Firmin Martin's message of "Thu, 6 May 2021 18:50:55 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 11A4C948-AEC4-11EB-8F9E-D152C8D8090B-77302942!pb-smtp1.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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.