delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/03/24/11:56:22

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F2E543858D3C
Authentication-Results: sourceware.org; dmarc=none (p=none dis=none)
header.from=SystematicSw.ab.ca
Authentication-Results: sourceware.org;
spf=none smtp.mailfrom=systematicsw.ab.ca
X-Authority-Analysis: v=2.4 cv=XrLphHJ9 c=1 sm=1 tr=0 ts=623c9492
a=oHm12aVswOWz6TMtn9zYKg==:117 a=oHm12aVswOWz6TMtn9zYKg==:17
a=IkcTkHD0fZMA:10 a=94nOnFI1EgyDtX4ev68A:9 a=QEXdDO2ut3YA:10
Message-ID: <27053602-8ec3-6202-8e77-99cc8dca366a@SystematicSw.ab.ca>
Date: Thu, 24 Mar 2022 09:56:01 -0600
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Subject: Re: Closing the Command Prompt using the "x" button doesn't update
shell history file
To: cygwin AT cygwin DOT com
References: <CAAvot88cUyx4g6d09B8-XKB4C1of0JgX2-31iMr1Em9+s-o35Q AT mail DOT gmail DOT com>
<20220324173350 DOT 93408efabc64014998e7b817 AT nifty DOT ne DOT jp>
Organization: Systematic Software
In-Reply-To: <20220324173350.93408efabc64014998e7b817@nifty.ne.jp>
X-CMAE-Envelope: MS4xfOEjvIBRqr97JYxH/Nuuf8fT3wel9ROmnkyl04p0POdRtJ+fUtTSCqTMffqvMSyf0zctFSDbLkBfS6WDK74Uf2AdGGy06E4zccUY5sk6eXTiIWYK2BAw
6kbILv4T6LX+C1TsLiT9FLqRZeaoMQhG3wXriWnUlqnGogYK4sLWI1Hm7LwiwEOqFgKyOCD+XN9064JHU7BlCL6R8BXVuKwNfYQ=
X-Spam-Status: No, score=-1170.2 required=5.0 tests=BAYES_00, GIT_PATCH_0,
KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW,
RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP,
T_SCC_BODY_TEXT_LINE 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 AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On 2022-03-24 02:33, 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)

I hope that's 100ms not 100s! Some comments would be good here.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019