Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16142

Re: [bug] PROMPT_COMMAND is not executed as expected in some situations

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: [bug] PROMPT_COMMAND is not executed as expected in some situations
Date 2020-04-15 17:35 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.359.1586986537.3066.bug-bash@gnu.org> (permalink)
References <00547d35-6a4e-bc3d-3845-e1fbf23a6469@quoininc.com> <8b3df1f1-de20-29e4-676b-7b8e8162ef8e@case.edu>

Show all headers | View raw


On 4/15/20 2:59 PM, Franklin, Jason wrote:

> Bash Version: 5.0
> Patch Level: 16
> Release Status: release
> 
> Description:
> 
> I have discovered that PROMPT_COMMAND is not executed before the
> printing of PS1 in the following three situations:

PROMPT_COMMAND is printed before PS1 when the shell goes to read a command.
(When you're using readline, readline prints the prompt initially, but
PROMPT_COMMAND works whether you're using editing or not.) That isn't true
in any of these cases.

> 
> (1) <C-x><C-e> is used
> (2) histverify is set
> (3) completion suggestions are shown

In cases 1 and 3, that all takes place within a single call to readline(),
even before the shell receives and tries to parse any of the line.

In the case of histverify, it's just about the same thing, technically
after the readline() call returns but before the shell parser gets the
line -- it's logically the same call.

These all pretty much all fall into the category of the editor reprinting
the prompt before it returns.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | NextNext in thread | Find similar


Thread

Re: [bug] PROMPT_COMMAND is not executed as expected in some situations Chet Ramey <chet.ramey@case.edu> - 2020-04-15 17:35 -0400
  Re: [bug] PROMPT_COMMAND is not executed as expected in some situations ami@fischman.org - 2020-04-18 13:59 -0700

csiph-web