From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24696 invoked by alias); 25 Sep 2006 21:17:55 -0000 Received: (qmail 24686 invoked by uid 22791); 25 Sep 2006 21:17:55 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 25 Sep 2006 21:17:53 +0000 Received: (qmail 17735 invoked from network); 25 Sep 2006 21:17:52 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 25 Sep 2006 21:17:52 -0000 To: gdb-patches@sourceware.org Subject: Re: [RFC] Never silently discard internal errors References: <20060925184223.GA15314@nevyn.them.org> <20060925200303.GA18759@nevyn.them.org> From: Jim Blandy Date: Mon, 25 Sep 2006 21:17:00 -0000 In-Reply-To: <20060925200303.GA18759@nevyn.them.org> (Daniel Jacobowitz's message of "Mon, 25 Sep 2006 16:03:03 -0400") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00180.txt.bz2 Daniel Jacobowitz writes: > On Mon, Sep 25, 2006 at 12:38:40PM -0700, Jim Blandy wrote: >> What if we simply had 'query' itself print out the prompt, followed by >> "[answering 'y', since standard input is not a terminal]" (or >> something more tasteful)? Then you wouldn't have to go around >> decorating all the calls to query. > > I assume that would be wrong for "set confirm off"? I don't want to turn this into a bikeshed discussion, but here's what I had in mind: *** utils.c 12 Jul 2006 11:50:18 -0700 1.168 --- utils.c 25 Sep 2006 14:17:20 -0700 *************** *** 1142,1152 **** int ans2; int retval; ! /* Automatically answer "yes" if input is not from the user ! directly, or if the user did not want prompts. */ ! if (!input_from_terminal_p () || !caution) return 1; if (deprecated_query_hook) { va_start (args, ctlstr); --- 1142,1168 ---- int ans2; int retval; ! /* If the user does not want prompts, answer "yes" automatically. */ ! if (! caution) return 1; + /* If input isn't coming from the user directly, just say what + question we're asking, and then answer "yes" automatically. This + way, important error messages don't get lost when talking to GDB + over a pipe. */ + if (! input_from_terminal_p ()) + { + wrap_here (""); + + va_start (args, ctlstr); + vfprintf_filtered (gdb_stdout, ctlstr, args); + va_end (args); + printf_filtered (_("(y or n) [answered yes; input not from terminal]")); + gdb_flush (gdb_stdout); + + return 1; + } + if (deprecated_query_hook) { va_start (args, ctlstr);