Re: Question about Ctrl-C and less - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Question about Ctrl-C and less
Date
Msg-id 20051016185434.GI5779@svana.org
Whole thread Raw
In response to Re: Question about Ctrl-C and less  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Question about Ctrl-C and less
List pgsql-hackers
On Sun, Oct 16, 2005 at 02:44:41PM -0400, Tom Lane wrote:
> Martijn van Oosterhout <kleptog@svana.org> writes:
> > This problem has been around for ever yet obviously not everybody runs
> > into it all the time like I do. Would patch to fix this be accepted or
> > is there a reason why not?
>
> I guess everybody else uses "q" not control-C to get out of less ;-)

Umm, Ctrl-C doesn't quit less, it aborts the current command. So if
it's doing a search or you've hit "F" (follow) or any number of other
things then the only way out is to press Ctrl-C. You have to press "q"
to quit less like you say.

> I'm not sure I agree with the concept of blocking SIGINT in this context
> --- you would not, I trust, propose blocking SIGQUIT or SIGHUP, but then
> why is it ok to block SIGINT?

The system() function blocks -INT and -QUIT, as does the shell when you
run a program, so why not?

> AFAICT it wouldn't fix the problem anyway, as there's still a bug in
> less: it doesn't restore the terminal settings on exit.

The point is, less is still running but psql it pulling the keystrokes
from under it... When you finally quit less it does restore the
settings, but now readline doesn't expect that as it's changed them
again...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Question about Ctrl-C and less
Next
From: Andrew Dunstan
Date:
Subject: Re: Question about Ctrl-C and less