zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk
Subject: Re: [PATCH]: New hook function "atexec"
Date: Fri, 17 Jul 2009 21:00:09 +0100	[thread overview]
Message-ID: <20090717210009.1570d7dd@pws-pc> (raw)
In-Reply-To: <943349.74078.qm@web37304.mail.mud.yahoo.com>

On Thu, 16 Jul 2009 23:27:49 -0700 (PDT)
Michael Hwang <nomex45@yahoo.com> wrote:
> I've hacked in a new hook function similar to preexec called "atexec".

That's a reasonable idea: some thoughts:

I'm not sure where this needs to be called execcmd(), there's so much
going on there.  The issue I'm most worried about is redirection; where
is the output of hook functions called in the middle of a pipeline going?

However, it also worries me that this is calling execcmd() recursively
in strange ways never before attempted---we partly set up a command for
execution, then call an entire arbitrary execution tree, then finish
executing the command.  This could easily have odd effects.  I wonder if
using execsave() and execrestore() might be sensible.

I'm surprised you only need to set atexec to zero in two places, but
there may be another way of testing the conditions you want anyway.

I don't see why you need the test for sourcelevel, which stops it
happening in all "." files.  That might be sensible for init files, but
otherwise it seems a bit arbitrary when other limitations might be more
useful.  For example, I don't see anything to stop this being run for
every individual command in every function run by the user, which could
be a huge overhead, probably more so that "." files which tend to be
one-off.  (I think the test for "sfcontext" happens to catch a lot of
completion functions, however.)  I'd be tempted to add a "locallevel"
test to exclude all function bodies.  If necessary we can think of a way
of reactivating it in a function.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  reply	other threads:[~2009-07-17 20:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17  6:27 Michael Hwang
2009-07-17 20:00 ` Peter Stephenson [this message]
2009-07-18  3:22 Michael Hwang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090717210009.1570d7dd@pws-pc \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).