zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: zero elapsed time in history with certain preexec functions
Date: Sat, 29 Dec 2007 10:33:07 -0800	[thread overview]
Message-ID: <071229103309.ZM7557@torch.brasslantern.com> (raw)
In-Reply-To: <477154ED.70001@csail.mit.edu>

On Dec 25,  2:07pm, Michael Kaminsky wrote:
}
} It appears that subscripting a variable (or indexing into a zsh array)
} inside of the preexec function causes zsh not to record the elapsed
} time/duration of the command.

A time is recorded, but it's the wrong time.

The following seems to fix it, but someone more familiar with this part
of the history mechanism should check my work: 

Index: Src/hist.c
===================================================================
diff -c -r1.31 hist.c
--- Src/hist.c	26 Nov 2007 17:38:13 -0000	1.31
+++ Src/hist.c	29 Dec 2007 18:24:06 -0000
@@ -826,7 +826,7 @@
     }
     chwordpos = 0;
 
-    if (hist_ring && !hist_ring->ftim)
+    if (hist_ring && !hist_ring->ftim && !strin)
 	hist_ring->ftim = time(NULL);
     if ((dohist == 2 || (interact && isset(SHINSTDIN))) && !strin) {
 	histactive = HA_ACTIVE;


(Revision numbers are from my local CVS repository and bear no relation
to the Sourceforce repository.)

-- 


  reply	other threads:[~2007-12-29 18:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-25 19:07 Michael Kaminsky
2007-12-29 18:33 ` Bart Schaefer [this message]
2008-01-03 17:23   ` Peter Stephenson

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=071229103309.ZM7557@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).