about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 9a8e7cd5d..3cf38d68c 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2012,7 +2012,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
 
     /* Make a copy of stderr for xtrace output before redirecting */
     fflush(xtrerr);
-    if (xtrerr == stderr && (type < WC_SUBSH || type == WC_TIMED)) {
+    if (isset(XTRACE) && xtrerr == stderr &&
+	(type < WC_SUBSH || type == WC_TIMED)) {
 	if (!(xtrerr = fdopen(movefd(dup(fileno(stderr))), "w")))
 	    xtrerr = stderr;
 	else