File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ zsh_trace_start () {
2+ echo " starting zsh tracing"
3+ # set the trace prompt to include seconds, nanoseconds, script name and line number
4+ # This is GNU date syntax; by default Macs ship with the BSD date program, which isn't compatible
5+ if [[ $ZSH_VERSION > 4.3.11 ]]; then
6+ zmodload zsh/datetime
7+ setopt promptsubst
8+ export PS4=' +$EPOCHREALTIME %N:%i> '
9+ else
10+ export PS4=' +$(date "+%s:%N") %N:%i> '
11+ fi
12+ # save file stderr to file descriptor 3 and redirect stderr (including trace
13+ # output) to a file with the script's PID as an extension
14+ exec 3>&2 2> /tmp/startlog.$$
15+ # set options to turn on tracing and expansion of commands contained in the prompt
16+ setopt xtrace prompt_subst
17+ trap ' setopt xtrace' EXIT
18+ }
19+
20+ zsh_trace_end () {
21+ # turn off tracing
22+ unsetopt xtrace
23+ # restore stderr to the value saved in FD 3
24+ exec 2>&3 3>& -
25+ echo " zsh tracing done. See /tmp/startlog.$$ "
26+ trap ' unsetopt xtrace' EXIT
27+ }
28+
You can’t perform that action at this time.
0 commit comments