Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Greg Wooledge Newsgroups: gnu.bash.bug Subject: Re: Q: Is there a way to tell why DEBUG trap was triggered? Date: Mon, 16 Mar 2020 13:00:19 -0400 Lines: 18 Approved: bug-bash@gnu.org Message-ID: References: <783f156f-7363-580a-5f95-37bfa20b1fdf@case.edu> <20200316170019.GU845@eeg.ccf.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: usenet.stanford.edu 1584378051 16549 209.51.188.17 (16 Mar 2020 17:00:51 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org Mail-Followup-To: bug-bash@gnu.org Content-Disposition: inline In-Reply-To: <783f156f-7363-580a-5f95-37bfa20b1fdf@case.edu> User-Agent: Mutt/1.10.1 (2018-07-13) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 139.137.100.1 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20200316170019.GU845@eeg.ccf.org> X-Mailman-Original-References: <783f156f-7363-580a-5f95-37bfa20b1fdf@case.edu> Xref: csiph.com gnu.bash.bug:16034 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.