fix peek
implementation in R6RS input ports
The peek operation must not block, otherwise the port behaves badly for `sync`. Based on a bug report from Brett Stahlman.
This commit is contained in:
parent
9dbc4842f7
commit
7304420691
|
@ -164,7 +164,7 @@
|
|||
n)))
|
||||
(lambda (bytes skip evt)
|
||||
(check-disconnect)
|
||||
(let ([n (peek-bytes-avail! bytes skip evt port)])
|
||||
(let ([n (peek-bytes-avail!* bytes skip evt port)])
|
||||
(if (eq? n 0)
|
||||
(wrap-evt port (lambda (v) 0))
|
||||
n)))
|
||||
|
|
6
pkgs/r6rs-pkgs/r6rs-test/tests/r6rs/io/sync.rkt
Normal file
6
pkgs/r6rs-pkgs/r6rs-test/tests/r6rs/io/sync.rkt
Normal file
|
@ -0,0 +1,6 @@
|
|||
#lang racket
|
||||
(require rnrs/io/ports-6)
|
||||
|
||||
;; Make sure that an R6RS port plays ok with sync,
|
||||
;; particularly when no input is available.
|
||||
(void (sync/timeout 0 (standard-input-port)))
|
Loading…
Reference in New Issue
Block a user