On Fri, Oct 21, 2005 at 01:53:32PM +0200, Martijn van Oosterhout wrote: > On Thu, Oct 20, 2005 at 08:11:14PM -0400, [EMAIL PROTECTED] wrote: > > I disagree that psql should make *any* assumptions about what SIGINT > > means to the child process. Consider less again, and Control-C used > > to abort a search. You are suggesting that Control-C should not only > > abort the search, but should also cut off the input from less. Less > > won't die. Less will just see a terminated input stream. What has been > > gained from this? Is this intuitive behaviour? > I must say I agree with the idea that Ctrl-C shouldn't stop the stream > from psql, but I'm willing to let it slide because a lot of other > programs work this way. I imagine asking it to be configurable will > meet even more resistance.
Which other ones? I can't think of one. The ones that don't handle SIGINT, or that are not designed for this scenario certainly don't count - as that is how psql works right now without the patch. Of the remaining programs that are designed to work with an application such as less, which ones purposefully close the input stream to less, and continue running? I think 0. > > I think the only reasonable behaviour is to ignore SIGINT within the > > parent, until the child exits. I don't see why other behaviours are > > even being considered. To me, it points at a misunderstanding of the > > problem. > I've been playing with a version of psql which on Ctrl-C doesn't > longjmp() but politely frees everything, waits for the pager and then > back to the main loop with the message "Interrupted". But now we have > another behaviour change: How to abort the gets() when you don't have > readline? > Doing it with a flag is a lot more susceptable to subtle behaviour > changes, but I'll see if I can make it work. SIG_IGN is the easiest, and the most effective. Certainly the easiest to maintain, and the least intrusive to the core. I don't understand. Cheers, mark -- [EMAIL PROTECTED] / [EMAIL PROTECTED] / [EMAIL PROTECTED] __________________________ . . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder |\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | | | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada One ring to rule them all, one ring to find them, one ring to bring them all and in the darkness bind them... http://mark.mielke.cc/ ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq