﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
1339	char-ready? returns #f even when input is available	Kooda		"The current implementation of char-ready? on stdio files returns #f if you have buffering enabled, didn’t consume the whole buffer and no more input is available from the system’s point of view, as it only asks the system via select or poll (see C_char_ready_p and C_check_fd_ready).

I’m afraid there’s no way to do better than this with stdio files, as there is no way of checking the state of the buffer.

The workaround I found was to simply disable buffering altogether, like so:

{{{
(set-buffering-mode! (current-input-port) #:none)
}}}

This bug probably requires a pretty big rework of ports.

Here is a little program that '''might''' show the erroneous behaviour:

{{{
(use posix)

(call-with-input-pipe ""echo coucou""
  (lambda (p)
    (let loop ((c (read-char p)))
      (unless (eof-object? c)
        (print c)
        (when (char-ready? p) (loop (read-char p)))))))
}}}"	defect	new	minor	someday	core libraries	4.11.0				insane
