Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: preexec hook: possible enhancement?
- X-seq: zsh-users 11823
- From: Matthew Wozniski <godlygeek@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: preexec hook: possible enhancement?
- Date: Wed, 5 Sep 2007 17:11:23 -0400
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:received:date:from:to:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=fdQaX2YmNjlzn2C/1y28OyHkD99OzKcCD8SPHnSTaeGAkBCWY33QEtzP8fho4k6JxMvuzMePadvIsVYnbnr6V0df4LXScGb7JxfTlsa/j8JedLkhrqtmVHLF3xPsCH3o4KRQKpyYRZwd/oXguBG5MGoV9U9Vow2Yk1LWgNy1w/g=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:date:from:to:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=I7eWsRN31JSSBEeXjZ6vaRLxfv7PdKbhdX37byhqBLXRJz9F549KUj1xTuPkgnHX15nGf6C7W+J0kpt8hnDWDJ58q0ULXioPP5CfCrh7QKIbUEpg5WV3S3or5jO7QPLw+PEPnaWv/2C9iWdWVjfhRD8VLu6Yo7tQW9X8WAXw6n4=
- In-reply-to: <200709051905.l85J5cHX003985@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <schaefer@xxxxxxxxxxxxxxxx> <070905101420.ZM28165@xxxxxxxxxxxxxxxxxxxxxx> <200709051905.l85J5cHX003985@xxxxxxxxxxxxxxxxxxx>
On Wed, Sep 05, 2007 at 08:05:38PM +0100, Peter Stephenson wrote:
> Bart Schaefer wrote:
> >
> > The TRAPDEBUG function is called at these points in the execution,
> > if you "setopt DEBUG_BEFORE_CMD". However, I don't remember offhand
> > whether it's possible to access the command text that is about to be
> > executed. The documentation for TRAPDEBUG is pretty sparse.
> >
> > (Also DEBUG_BEFORE_CMD requires a very recent zsh version.)
>
> I doubt if there's much joy there... debug traps are called before/after
> every command, including in precmd and preexec, so probably far too
> often. (They're for debugging, right?) The only argument to a
> TRAPDEBUG function is the signal number, which is meaningless in this
> case anyway. The older stuff like this ksh import doesn't tend to be
> tightly enough defined to be useful interactively.
Yeah, that's what I gathered. Since there doesn't seem to be a way to
get the text of the currently executing command from the debug trap,
nor to even tell if the currently executing was entered interactively,
I don't see any reasonable way to proceed down that road.
> The idea of a hook between pipelines is actually rather different from
> preexec and precmd; those get run around the time the shell fetches the
> line for editing, rather than in the middle of execution. Running
> something after every pipeline would have to dig its mitts into into the
> execution tree, which is why Bart suggested debug traps.
I had a feeling it wouldn't be easy, but maintained a bit of hope that
somewhere along the line there was a function being called that was
both called for every command in an interactive pipeline and knew the
full text of the command it was being called for. zsh's source is
still a bit scary for me, so I figured I should ask.
> It doesn't look like there's a clean way to do this.
Thanks for the input PWS. :)
~Matt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author