lib/core: add blocking eof implementation
authorLucas Bajolet <lucas.bajolet@gmail.com>
Wed, 9 May 2018 01:54:07 +0000 (21:54 -0400)
committerLucas Bajolet <lucas.bajolet@gmail.com>
Fri, 11 May 2018 18:41:12 +0000 (14:41 -0400)
commit39338890006134d0c5718bc48f237460de3d88cf
tree884f62dac92139ce5a96162f0227b42d7c952314
parente1860777c47688b1bf7b1be811f1c0264d766200
lib/core: add blocking eof implementation

eof is a problematic operation for Streams as its state may be decided
by reading input (in sockets for instance).

Because of that, operations relying on it may read one extra byte at the
end of a file, causing the apparition of bad characters (null byte, or
replacement character).

By changing the semantic of eof and making it blocking, we ensure that
querying eof will always produce the appropriate error.

Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
lib/core/file.nit
lib/core/stream.nit