Re: Question about Ctrl-C and less

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Question about Ctrl-C and less
Date: 2005-10-16 18:54:34
Message-ID: 20051016185434.GI5779@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Oct 16, 2005 at 02:44:41PM -0400, Tom Lane wrote:
> Martijn van Oosterhout <kleptog(at)svana(dot)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(at)svana(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2005-10-16 20:06:04 Re: Question about Ctrl-C and less
Previous Message Tom Lane 2005-10-16 18:44:41 Re: Question about Ctrl-C and less