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

RE: Cygwin, zpty and EOL



> On Jul 6,  7:21pm, Andrej Borsenkow wrote:
> } Subject: Cygwin, zpty and EOL
> }
> } I noted very interesting thing - every ptyread() returns
> single line, at
> } the end of line I see read() that returns 0 (zero) bytes.
>
> That's because it's using a non-blocking read.
>

Huh? May be I was not clear - it happened only on *Cygwin*. The same
output on Unix is read in full. So, if it relates to non-blocking read,
then Cygwin behaves very strange is this respect.

Eh, and can you explain, how non-blocking read relates to EOF after
every line? If terminal is in non-blocking mode, and no data is
available, read() returns -1 and sets errno to EWOULDBLOCK or EAGAIN
(that are the same here).

Consider:

Unix:

bor@itsrm2% zmodload zsh/zpty
bor@itsrm2% zpty ls ls
bor@itsrm2% zpty -r ls
Brodsky      addrbook.d   dikz         observe      test
FM2000       bin          fnt          save         tmp
ICONS        dead.letter  mail         src          xxxx

Cygwin (to work around EOL problem):

mw1g017@MW1G17C:~% zmodload zsh/zpty
mw1g017@MW1G17C:~% zpty ls ls
mw1g017@MW1G17C:~% zpty -r ls foo
mw1g017@MW1G17C:~% print ${foo//$'\C-M\C-M'/$'\C-J'}
GIZ              Outlook Express  autoname.dat     q.log
mw1g017@MW1G17C:~% ls
GIZ              Outlook Express  autoname.dat     q.log
MAD_COW.doc      Palm             foo              serial.txt
MAD_COW.zip      Pilot            foo1             sm.dat
My Documents     Win2k            gdbtk.ini        src
Old old old      _viminfo         profile-NT4      test

-andrej



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