diff --git a/collects/tests/racket/port.rktl b/collects/tests/racket/port.rktl index 980b428cf5..4577b9e067 100644 --- a/collects/tests/racket/port.rktl +++ b/collects/tests/racket/port.rktl @@ -42,7 +42,8 @@ (test eof peek-char p) (test eof read-char p) (test #f sync/timeout 0 progress-evt5) - (test #f port-commit-peeked 1 progress-evt5 always-evt p))))))) + ;; it happens that a commit of EOF succeeds for tested ports: + (test #t port-commit-peeked 1 progress-evt5 always-evt p))))))) (test-hello-port (open-input-string "hello") #f) (test-hello-port (open-input-string "hello") #t) diff --git a/src/racket/src/port.c b/src/racket/src/port.c index 5a469fa51f..5977e707c1 100644 --- a/src/racket/src/port.c +++ b/src/racket/src/port.c @@ -2325,9 +2325,11 @@ intptr_t scheme_get_byte_string_unless(const char *who, unless_evt = SCHEME_PTR2_VAL(unless_evt); if (ip->pending_eof > 1) { - ip->pending_eof = 1; - if (ip->progress_evt) - post_progress(ip); + if (!peek) { + ip->pending_eof = 1; + if (ip->progress_evt) + post_progress(ip); + } gc = EOF; } else { /* Call port's get or peek function. But first, set up