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

Re: Do file descriptors survive to subshell?



On 12 September 2016 at 20:24, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> ?? That's not how "read" is defined.  It either reads a line if it can,
> or it returns failure if it can't.  The -t option only changes what
> "it can't" means, and the -u option only changes where it reads it.
> You can change how "a line" is defined, but you can't define "a line"
> as nothing.
>
> You might suggest that -k 0 should test whether reading is possible and
> return success without actually reading anything, but as currently
> defined "read" returns nonzero only when bytes are consumed.

That's quite regretful, how to check if a read descriptor is valid? To
test if a descriptor is inherited from previous Zsh execution I
switched to write descriptors and use print -u $EXPORTED_FD -n to test
them, this works.

Best regards,
Sebastian Gniazdowski



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