VSCode sometimes opens certain file descriptors whan you run a terminal nested in it. The tests A04redirect.ztst assumes fd 99 is
not used and hence tries to gather an error message from
echo >&99
However, if the fd 99 has been previously opened there is no error, the error message is empty and
subsequent comparisons to it fail.
In this patch I propose to test fd 99, 100, 101, … until an
unused fd is found. With this change the test passes even if the terminal is in VScode.
-------
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index 17f6dfa29..c5120ca8f 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -4,7 +4,8 @@
mkdir redir.tmp && cd redir.tmp
myfd=99
- (echo >&$myfd) 2>msg
+ # Find an unused fd
+ while (echo >&$myfd) 2>msg ;do ((myfd++)); done
bad_fd_msg="${$(<msg)##*:}"
%test