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


Groups > gnu.bash.bug > #16034

Re: Q: Is there a way to tell why DEBUG trap was triggered?

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: Q: Is there a way to tell why DEBUG trap was triggered?
Date 2020-03-16 13:00 -0400
Message-ID <mailman.1.1584378051.3020.bug-bash@gnu.org> (permalink)
References <CAOdNpm_9gFMXFJigxYgSVHgWwKdA0XE-TvbabXSs85d=R6WREQ@mail.gmail.com> <783f156f-7363-580a-5f95-37bfa20b1fdf@case.edu> <20200316170019.GU845@eeg.ccf.org>

Show all headers | View raw


On Mon, Mar 16, 2020 at 09:47:44AM -0400, Chet Ramey wrote:
> On 3/15/20 7:41 AM, Šimon Let wrote:
> > Hi All,
> > 
> > I'm using PROMPT_COMMAND and DEBUG trap to emulate "PRE" and "POST" hooks
> > in bash. I have run into the issue where the DEBUG trap gets triggered when
> > any custom readline widget/function is executed. I would like to
> > programmatically determine if the DEBUG trap was triggered for a "real"
> > interactive command or if it was triggered for a custom readline widget.
> Since the DEBUG trap happens before the command executes, it's not a real
> `post-command' hook.

I think they simply stated things backwards.  The DEBUG trap is a
pre-command hook, and PROMPT_COMMAND is post-command.  Sort of/close
enough.

That said, I'm not sure what a "custom readline widget" is.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Q: Is there a way to tell why DEBUG trap was triggered? Greg Wooledge <wooledg@eeg.ccf.org> - 2020-03-16 13:00 -0400

csiph-web