Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A question about debugging zsh using set -x to an independent log file
- X-seq: zsh-users 22683
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: A question about debugging zsh using set -x to an independent log file
- Date: Sat, 22 Apr 2017 20:58:47 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=nxAd9jhLjmff1ialJwMpeZ02M9Ud1dRNfYSEdnSloWI=; b=FBYy7uPGM2DT028UY7VlKnASvIvhm4ExyQcJj5xBAv+dITJosyiy3bBbx0AlFgmFN4 D2Y+c8ftIDbRfKQx3DyIPL3rXEo2aP95LNCZEDyw4rX73daKS9fjtn8h5jZJ9iKqxlvm +XvwD/hyNevyDKXax1zTprBLkOU4bW5cYRa2YUMFaXTMZhF3GkIKq1HD6CTKVi3LhhIO 8bNWh/+yUGoFASCvOW2rV3kAgyog6H+YMQutbjJ2VPJYAtKejG5BIJs8fWbFLrb57ZgV A8AFZRR+faapDaKfH5JgS0OFCgw+Qv1pjkCcsk0gmEaEXphc5qOjKg2WDufa2WUz6cBe XH1w==
- In-reply-to: <CAKsPscM31c0kOOkoVCF5gd9fYxXn=Z6i-bCC8eLObXfeFrT1qA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKsPscM31c0kOOkoVCF5gd9fYxXn=Z6i-bCC8eLObXfeFrT1qA@mail.gmail.com>
On Apr 22, 7:56pm, Steven Lu wrote:
}
} The problem is that this is a heisenbug and it comes and goes, the shell
} will be simply unusable when the xtrace output is there, and I can't really
} use the shell effectively if I redirect stderr to a file.
You probably want to use a trap on the DEBUG pseudo-signal, e.g.,
TRAPDEBUG() {
print -r -- "$ZSH_DEBUG_CMD" >> your_trace_file
}
Or for closer congruence to set -x
trap '{ print -nP -- "$PS4"
print -r -- "$ZSH_DEBUG_CMD" } >> your_trace_file' DEBUG
This requires "setopt DEBUG_BEFORE_CMD" but unless you've deliberately
unset that, it is set by default.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author