[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unfinished command executed when TTY is closed
From: |
Chet Ramey |
Subject: |
Re: unfinished command executed when TTY is closed |
Date: |
Thu, 18 Dec 2014 09:08:37 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
On 12/17/14, 3:23 PM, Greg Wooledge wrote:
> On Wed, Dec 17, 2014 at 03:16:53PM -0500, Steve Simmons wrote:
>> Advance apologies if I'm misunderstanding, but the described bug looks like
>> reasonable behavior to me.
>
> It would be more reasonable for bash (or ssh, I'm not sure at what level
> this handling should occur) to discard the partially typed line. Not
> to execute it.
>
> If I open an rxvt and type "touch this_file_should_not_exist" but do not
> press Enter, and then I close the terminal using my window manager's
> "Close" functionality, bash does not execute the partially-typed command.
> (Verified by the absence of the file in a new window.)
The timing was right: the shell received SIGHUP, it interrupted read(2),
and the shell exited. This is how it happens in the vast majority of
cases.
What the original complaint refers to is what to do in the infrequent
case when the terminal goes away, the kernel doesn't deliver a SIGHUP,
and a read returns EOF instead of -1.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
Re: unfinished command executed when TTY is closed, Piotr Grzybowski, 2014/12/18