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

From Sean Utt
Subject Re: Question about Ctrl-C and less
Date
Msg-id 012401c5d752$6512fb00$0201a8c0@randomnoise
Whole thread Raw
In response to Re: Question about Ctrl-C and less  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Question about Ctrl-C and less
List pgsql-hackers
> It won't work properly that way.  SIGINT gets sent to all the members
> of the process group, not just the child.  Psql isn't responsible for
> sending ctrl-c through to the child.



Except that if I am in less, and I do CONTROL-C, it doesn't do anything at 
all.

It doesn't exit.

If I send a kill -2 to the process, it doesn't exit. less ignores SIGINT 
completely.

So, whether or not they are working together in cooperation, the result we 
have been seeing when typing CONTROL-C is completely under the control of 
psql.

I do realize that the problem is one of when and how to cancel the query if 
CONTROL-C is pressed.
If the query is still building and the output hasn't, or won't be, sent to 
the pager, cancel the query.
If we are in the pager, don't respond to CONTROL-C, and instead output a 
helpful hint telling people to use q to quit, which will do what they really 
wanted anyway.
In theory, we already deal gracefully with q being pressed in the pager.

Sean





pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Query Progress Estimator
Next
From: Thomas Hallgren
Date:
Subject: Re: Lifecycle management