1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-16 10:01:16 +01:00

zsh-workers/10150

This commit is contained in:
Tanaka Akira 2000-03-16 00:42:50 +00:00
parent 2d44a00df1
commit f85d4b147d
2 changed files with 27 additions and 3 deletions

View file

@ -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

View file

@ -2,6 +2,11 @@
%prep
mkdir xtrace.tmp && cd xtrace.tmp
function xtf {
local regression_test_dummy_variable
print "$*"
}
echo 'print "$*"' > xt.in
%test
@ -21,7 +26,11 @@
repeat 1 do print 'Tracing: do builtin done'; done
repeat 1 do print 'Tracing: do builtin done 2>file'; done 2>>xtrace.err
repeat 1 do cat <<<'Tracing: do external done'; done
repeat 1 do cat <<<'Tracing: do external done'; done 2>>xtrace.err
repeat 1 do cat <<<'Tracing: do external done 2>file'; done 2>>xtrace.err
xtf 'Tracing: function'
xtf 'Tracing: function 2>file' 2>>xtrace.err
. ./xt.in 'Tracing: source'
. ./xt.in 'Tracing: source 2>file' 2>>xtrace.err
set +x
cat xtrace.err
0:xtrace with and without redirection
@ -40,7 +49,11 @@
>Tracing: do builtin done
>Tracing: do builtin done 2>file
>Tracing: do external done
>Tracing: do external done
>Tracing: do external done 2>file
>Tracing: function
>Tracing: function 2>file
>Tracing: source
>Tracing: source 2>file
>+ZTST_execchunk:2> print Tracing: ( builtin ) 2>file
>+ZTST_execchunk:2> cat
>+ZTST_execchunk:2> print Tracing: { builtin } 2>file
@ -57,4 +70,14 @@
?+ZTST_execchunk:2> cat
?+ZTST_execchunk:2> print Tracing: do builtin done
?+ZTST_execchunk:2> cat
?+ZTST_execchunk:2> xtf Tracing: function
?+xtf:0> local regression_test_dummy_variable
?+xtf:0> print Tracing: function
?+ZTST_execchunk:2> xtf Tracing: function 2>file
?+xtf:0> local regression_test_dummy_variable
?+xtf:0> print Tracing: function 2>file
?+ZTST_execchunk:2> . ./xt.in Tracing: source
?+./xt.in:1> print Tracing: source
?+ZTST_execchunk:2> . ./xt.in Tracing: source 2>file
?+./xt.in:1> print Tracing: source 2>file
?+ZTST_execchunk:2> set +x