Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16033
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Q: Is there a way to tell why DEBUG trap was triggered? |
| Date | 2020-03-16 09:47 -0400 |
| Message-ID | <mailman.2792.1584366474.2412.bug-bash@gnu.org> (permalink) |
| References | <CAOdNpm_9gFMXFJigxYgSVHgWwKdA0XE-TvbabXSs85d=R6WREQ@mail.gmail.com> <783f156f-7363-580a-5f95-37bfa20b1fdf@case.edu> |
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 tried to use READLINE_LINE and READLINE_POINT variables but these are not > set during the DEBUG trap. They're not set when the the DEBUG trap runs before, say, a shell function you've bound to a key sequence using `bind -x' is executed, but they're available to commands called from within that shell function. > Is there another way that can be used to determine why the DEBUG trap was > triggered? No. > PS: I'm wondering what is your opinion on providing PRE and POST functions > natively in bash? I'd have to see a compelling reason to implement them. Chet -- ``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 | Next | Find similar
Re: Q: Is there a way to tell why DEBUG trap was triggered? Chet Ramey <chet.ramey@case.edu> - 2020-03-16 09:47 -0400
csiph-web