From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-04.nifty.com (conssluserg-04.nifty.com [210.131.2.83]) by sourceware.org (Postfix) with ESMTPS id E6CAB385842B for ; Wed, 27 Apr 2022 14:09:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E6CAB385842B Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=nifty.ne.jp Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp Received: from Express5800-S70 (ak044095.dynamic.ppp.asahi-net.or.jp [119.150.44.95]) (authenticated) by conssluserg-04.nifty.com with ESMTP id 23RE9IQw010313 for ; Wed, 27 Apr 2022 23:09:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com 23RE9IQw010313 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1651068558; bh=4lvCJu0XGM5NhfOBmUeog/O8E8mddaFZ78Y5JEwsT7g=; h=Date:From:To:Subject:In-Reply-To:References:From; b=bJIsxauEQrMUQbKGGfZ4Bly4cyBl8st42up+qpv14Hkk+IUf7JI2FQCM0+mTGS9hs gW9H2KBvZdGK4ZZzQICQ6WiTDpblijfaE2cD0sEmCHvrMpDb6/eLaT5JhSZUHicC6J BjRvwY177grOQ+e7kWxmQiqg3rM/m5NpT9S7eCvVYQh3hyeDR2aQIS3JTgk/nLHMR+ 3CCpsjzkQ8Ii9bH6rkmtQkuQfWLRyYgf+eAzCMbg3i//OuNg2Wk+BK+8hdjgTFJEVI kHR/o1KHj5Y4GgEVbT8sWlJAtsGqy9YjSMjEJINZbKDdEek19RPVkurcKKa/uzzWG/ Bu+VmAB062rZw== X-Nifty-SrcIP: [119.150.44.95] Date: Wed, 27 Apr 2022 23:09:21 +0900 From: Takashi Yano To: cygwin@cygwin.com Subject: Re: Closing the Command Prompt using the "x" button doesn't update shell history file Message-Id: <20220427230921.803c3e73a93bcfad6f122c30@nifty.ne.jp> In-Reply-To: <20220324173350.93408efabc64014998e7b817@nifty.ne.jp> References: <20220324173350.93408efabc64014998e7b817@nifty.ne.jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2022 14:09:37 -0000 On Thu, 24 Mar 2022 17:33:50 +0900 Takashi Yano wrote: > On Wed, 23 Mar 2022 15:11:20 -0400 > Mitchell Hentges wrote: > > To reproduce the issue: > > 1. Run Cygwin.bat to open a Cygwin shell in the "Command Prompt" terminal > > 2. Run some command, such as "echo test" > > 3. Click the Windows "x" button in the top-right corner of the terminal > > > > The terminal closes, but `$HOME/.bash_history` is not updated to include > > the "echo test" command. > > Interestingly, when using mintty, the shell history is indeed saved when > > the "x" button is pressed. > > I looked into this problem, and found cygwin sends SIGHUP on > window closure, however, bash is terminated before SIGHUP is > processed. > > The following patch solves the issue, however, I wonder if > there is better way to wait completion of signal handling. > > diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc > index f946bed77..87b419ea7 100644 > --- a/winsup/cygwin/exceptions.cc > +++ b/winsup/cygwin/exceptions.cc > @@ -1119,6 +1119,7 @@ ctrl_c_handler (DWORD type) > { > sig_send (NULL, SIGHUP); > saw_close = true; > + Sleep (100); > return FALSE; > } > if (!saw_close && type == CTRL_LOGOFF_EVENT) Does anyone have suggenstion on this? -- Takashi Yano