Re: proposal - psql - use pager for \watch command

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal - psql - use pager for \watch command
Date: 2021-03-23 17:09:48
Message-ID: CAFj8pRCqzG0BU6OyDdx=8J-BM0TaoC7SdB-wsUzrc-M-1wT9hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

po 22. 3. 2021 v 13:13 odesílatel Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
napsal:

> On Mon, Mar 22, 2021 at 5:10 PM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
> > probably there will not be an issue inside ncurses - the most complex
> part of get_event is polling of input sources - tty and some other. The
> pspg should not to stop there on tty reading.
>
> The problem is that Apple's /dev/tty device is defective, and doesn't
> work in poll(). It always returns immediately with revents=POLLNVAL,
> but pspg assumes that data is ready and tries to read the keyboard and
> then blocks until I press a key. This seems to fix it:
>
> +#ifndef __APPLE__
> + /* macOS can't use poll() on /dev/tty */
> state.tty = fopen("/dev/tty", "r+");
> +#endif
> if (!state.tty)
> state.tty = fopen(ttyname(fileno(stdout)), "r");
>
> A minor problem is that on macOS, _GNU_SOURCE doesn't seem to imply
> NCURSES_WIDECHAR, so I suspect Unicode will be broken unless you
> manually add -DNCURSES_WIDECHAR=1, though I didn't check.
>

For record, this issue is fixed in pspg 4.5.0.

Regards

Pavel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-03-23 17:19:18 Re: making update/delete of inheritance trees scale better
Previous Message Pavel Stehule 2021-03-23 17:08:23 Re: new release pspg