Re: In MacOS, psql reacts on SIGINT in a strange fashion (Linux is fine)

From: Dmitry Koterov <dmitry(dot)koterov(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: In MacOS, psql reacts on SIGINT in a strange fashion (Linux is fine)
Date: 2024-04-14 02:05:59
Message-ID: CA+CZih5ck1-ZCvyM8a8GXzLb3e6D-EG27f2NTrBo49G5DF+mmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks to everyone!

I will file a bug.

Anyways, I just built a tool to work-around it all. It allows to run psql
from processes which don't handle SIGINT in a proper shell-like manner
(like yarn for instance): https://github.com/dimikot/run-in-separate-pgrp

Basically, without this, an attempt to run `yarn psql` and then pressing ^C
kills yarn (it kills it in Linux too, since ^C propagates SIGINT to all
processes in the foreground group), because yarn doesn't behave nicely with
exit codes (and exit signals) of its child processes. With
run-in-separate-pgrp wrapping, ^C is only delivered to psql.

On Sat, Apr 13, 2024 at 5:09 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
> > On Sun, Apr 14, 2024 at 11:49 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> OK, I tried dtruss'ing psql on macOS. What I see is that with
> >> Apple's libedit, the response to SIGINT includes this:
> >> kill(0, 2) = 0 0
>
> >
> https://github.com/NetBSD/src/blob/1de18f216411bce77e26740327b0782976a89965/lib/libedit/sig.c#L110
>
> Ah, I was wondering if that was from upstream libedit or was an
> Apple-ism. Somebody should file a bug.
>
> regards, tom lane
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2024-04-14 03:14:46 SupportRequestRows support function for generate_series_timestamptz
Previous Message Wen Yi 2024-04-14 02:02:00 Re: Things I don't like about \du's "Attributes" column