Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: correct A04redirect.ztst so that it works on VSCode



> On 29/11/2023 17:45 GMT Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> 
>  
> On Tue, Nov 28, 2023 at 2:18 PM German Riano <griano@xxxxxxxxx> wrote:
> >
> > VSCode sometimes opens certain file descriptors whan you run a terminal nested in it.
> 
> Thanks for the report and suggested fix.  Question for zsh-workers --
> could we just do this?
> 
> bad_fd_msg="${$( { exec 9>&-; echo >&9 } 2>&1)##*:}"
> 
> That is, don't bother assigning myfd=99 in the first place (the test
> script never uses this value of myfd again) and in the subshell
> explicitly close an arbitrary FD before trying to use it?  The only
> restriction seems to be that the descriptor tested must not be 0/1/2
> or we won't get the error.  Also the pass through the "msg" temporary
> file seems unnecessary too?

Don't see why not.

Remember we also have the more predictable behaviour of

exec {myfd}>&1

to open a known $myfd, which we could then simply close.  But apart from
purity points this may not gain very much.

pws




Messages sorted by: Reverse Date, Date, Thread, Author