zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Pascal Wittmann <PascalWittmann@gmx.net>, zsh-workers@zsh.org
Subject: Re: Is there some postexec function?
Date: Wed, 06 Jul 2011 13:07:26 -0700	[thread overview]
Message-ID: <110706130726.ZM8132@torch.brasslantern.com> (raw)
In-Reply-To: <4E1481BF.3060008@gmx.net>

On Jul 6,  5:39pm, Pascal Wittmann wrote:
}
} I wonder whether there exists a postexec function, a function that is
} called, after a command is executed. I need something like that, because
} I'm trying to print (redraw the prompt) the exit code of a program in
} the prompt where it was called.

What does "in the prompt where it was called" mean, exactly?  Can you
give an example?

If it means what it appears to, you can't do it without subverting the
edit/execute paradigm.  The line editor is active, and thus the prompt
modifiable, right up until you commit to executing the command; then
the line editor exits, the command runs, and after the command is done
a new line editor starts up with a fresh prompt.

You could create a widget that runs the command, captures its status,
and updates the prompt, all within the line editor context, but that
would do odd things with job control and pipelines.  Or you could try
to play cursor movement games to overwrite the previous prompt with
something that was output with "print -P", but depending on what the
command does with the screen that may be impractical.

} I've found some references¹ to such a function, but they didn't worked
} on my system. I'm using zsh 4.3.12.

There's never been a postexec function, that must be someone's idiom
for something they've implemented another way (perhaps through precmd
as referenced by Jeremie).


  parent reply	other threads:[~2011-07-06 20:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-06 15:39 Pascal Wittmann
2011-07-06 15:48 ` Jérémie Roquet
2011-07-06 17:01 ` ZyX
2011-07-06 20:07 ` Bart Schaefer [this message]
2011-07-06 20:28   ` Pascal Wittmann
2011-07-07  3:27     ` Bart Schaefer

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=110706130726.ZM8132@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=PascalWittmann@gmx.net \
    --cc=zsh-workers@zsh.org \
    /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).