Re: psql screen size - Mailing list pgsql-general

From Gregory Stark
Subject Re: psql screen size
Date
Msg-id 87od138x2y.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: psql screen size  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: psql screen size  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-general
Gregory Stark <stark@enterprisedb.com> writes:

> Could you define "messed up"?
>
> What I see is that the query output is formatted correctly but readline still
> thinks the screen is the old size. (This is in CVS HEAD -- this code was
> definitely different in 8.3 and before so the behaviour may be different).
>
> Perhaps we need to tell readline whenever we run a subprocess and it may have
> missed screen resize signals.

Hm, this Bash FAQ seems to indicate this shouldn't be a problem -- the whole
process group is supposed to get the window size. Psql isn't doing the job
control stuff the FAQ entry talks about so the pager ought to be in the same
process group. So I'm puzzled.

http://tiswww.case.edu/php/chet/bash/FAQ

->  E11) If I resize my xterm while another program is running, why doesn't bash
->       notice the change?
->
->  This is another issue that deals with job control.
->
->  The kernel maintains a notion of a current terminal process group.  Members
->  of this process group (processes whose process group ID is equal to the
->  current terminal process group ID) receive terminal-generated signals like
->  SIGWINCH.  (For more details, see the JOB CONTROL section of the bash
->  man page.)
->
->  If a terminal is resized, the kernel sends SIGWINCH to each member of
->  the terminal's current process group (the `foreground' process group).
->
->  When bash is running with job control enabled, each pipeline (which may be
->  a single command) is run in its own process group, different from bash's
->  process group.  This foreground process group receives the SIGWINCH; bash
->  does not.  Bash has no way of knowing that the terminal has been resized.
->
->  There is a `checkwinsize' option, settable with the `shopt' builtin, that
->  will cause bash to check the window size and adjust its idea of the
->  terminal's dimensions each time a process stops or exits and returns control
->  of the terminal to bash.  Enable it with `shopt -s checkwinsize'.


--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's RemoteDBA services!

pgsql-general by date:

Previous
From: Abdul Rahman
Date:
Subject: Re: Replication with slony-I
Next
From: Sim Zacks
Date:
Subject: sum the text of a text field