Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Is there some postexec function?
On 07/06/2011 10:07 PM, Bart Schaefer wrote:
> 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.
Thanks for clearing things up! I didn't knew about the edit/execute
paradigm and I don't wont to subvert it, so I'll forget about my idea.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author