zsh-users
 help / color / mirror / code / Atom feed
* Reduce forking overhead in precmd()
@ 2002-09-18 22:31 Paul Lew
  2002-09-18 22:47 ` Clint Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Lew @ 2002-09-18 22:31 UTC (permalink / raw)
  To: zsh-users

I have a precmd() that I would like to augment to include source
control freeze info (we use clearcase, a freeze will change the way
files are represented).

precmd ()
{
    ....

    if [[ $CLEARCASE_ROOT != "" ]]; then
        RPROMPT=${RPROMPT:s/"%S f %s "//}
        cleartool catcs | grep time > /dev/null
	if [[ $? == 0 ]]; then
	    RPROMPT="%S f %s %$RPROMPT"
	fi
    fi
}

Basically the "cleartool catcs" command is required, if its output
contain 'time', then there is a freeze condition which I will modify
the RPROMPT to include an indicator.

However, this still added 2 more forks per command and the response is
not that desirable.  Any way to speed this up, for example, is there
a way in zsh to replace the 'grep' above?

Thanks in advance.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Reduce forking overhead in precmd()
  2002-09-18 22:31 Reduce forking overhead in precmd() Paul Lew
@ 2002-09-18 22:47 ` Clint Adams
  2002-09-19  1:25   ` Paul Lew
  0 siblings, 1 reply; 3+ messages in thread
From: Clint Adams @ 2002-09-18 22:47 UTC (permalink / raw)
  To: Paul Lew; +Cc: zsh-users

>         cleartool catcs | grep time > /dev/null
> 	if [[ $? == 0 ]]; then
> 	    RPROMPT="%S f %s %$RPROMPT"
> 	fi

You could do something like

[[ -n ${${(M)${$(cleartool catcs)}:#*time*}} ]] && RPROMPT="%S f %s %$RPROMPT"


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Reduce forking overhead in precmd()
  2002-09-18 22:47 ` Clint Adams
@ 2002-09-19  1:25   ` Paul Lew
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Lew @ 2002-09-19  1:25 UTC (permalink / raw)
  To: Clint Adams; +Cc: zsh-users

>>>>> "Clint" == Clint Adams <clint@zsh.org> writes:

    Clint> You could do something like:

    Clint> [[ -n ${${(M)${$(cleartool catcs)}:#*time*}} ]] &&
    Clint> 	RPROMPT="%S f %s %$RPROMPT"

That works, however, it turns out that the weakiest link is the
'cleartool catcs' command and optimized out grep did not help much.

Now I have moved this section into periodic function and the result is
much better.  Thanks!!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-19  1:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-18 22:31 Reduce forking overhead in precmd() Paul Lew
2002-09-18 22:47 ` Clint Adams
2002-09-19  1:25   ` Paul Lew

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).