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

2024-04-13 Thread Dmitry Koterov
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

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

2024-04-13 Thread Tom Lane
Thomas Munro writes: > On Sun, Apr 14, 2024 at 11:49 AM Tom Lane 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 >

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

2024-04-13 Thread Thomas Munro
On Sun, Apr 14, 2024 at 11:49 AM Tom Lane wrote: > Dmitry Koterov writes: > > I wish it was zsh... I tested it with zsh, but with bash (and with > > low-level kill syscall), I observed the same effect unfortunately. > > > So it's still a puzzle. > > > 1. Even more, when I send a kill() low-level

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

2024-04-13 Thread Dmitry Koterov
> 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 OK, so it's libedit who does this. I should've tried drtuss instead of not quite working lldb. I'll try to dig further. Thank you, Tom! >

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

2024-04-13 Thread Tom Lane
Dmitry Koterov writes: > I wish it was zsh... I tested it with zsh, but with bash (and with > low-level kill syscall), I observed the same effect unfortunately. > So it's still a puzzle. > 1. Even more, when I send a kill() low-level syscall using e.g. Perl - perl > -e 'kill("INT", 16107)' - it

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

2024-04-13 Thread Thomas Munro
On Sun, Apr 14, 2024 at 11:18 AM Dmitry Koterov wrote: > Can it be e.g. readline? Or something related to tty or session settings > which psql could modify (I did not find any in the source code though). I was wondering about that. Are you using libedit or libreadline? What happens if you

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

2024-04-13 Thread David G. Johnston
On Saturday, April 13, 2024, Dmitry Koterov wrote: > > > % psql --version > psql (PostgreSQL) 16.0 > How did you install this and can you install other, supported, versions? David J.

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

2024-04-13 Thread Tom Lane
Dmitry Koterov writes: > I almost lost my mind today trying to figure out why sending a SIGINT > precisely to a psql interactive process delivers this SIGINT not only to > that psql, but also to its parents. Let me guess ... you're using zsh not bash? I do not use zsh myself, but what I read in

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

2024-04-13 Thread Dmitry Koterov
Hi. Preamble: this happens in MacOS only (in built-in Terminal and in iTerm2 at least). In Linux, everything is as expected. I almost lost my mind today trying to figure out why sending a SIGINT precisely to a psql interactive process delivers this SIGINT not only to that psql, but also to its