diff --git a/collects/mzlib/port.rkt b/collects/mzlib/port.rkt index 2a87650775..81ce65d631 100644 --- a/collects/mzlib/port.rkt +++ b/collects/mzlib/port.rkt @@ -710,7 +710,7 @@ ;; write (lambda (str start end buffer? w/break?) (if (= start end) - #t + 0 (begin (resume-mgr) (call-with-semaphore diff --git a/collects/tests/racket/portlib.rktl b/collects/tests/racket/portlib.rktl index d07e1c7470..3694437cc8 100644 --- a/collects/tests/racket/portlib.rktl +++ b/collects/tests/racket/portlib.rktl @@ -877,6 +877,23 @@ (eq? (cadr r) 4) (memq (cadr r) '(2 4)))))) + +(let-values ([(in out) (make-pipe-with-specials)]) + (struct str (v) + #:property prop:custom-write + (lambda (a-str port mode) + (let ([recur (case mode + [(#t) write] + [(#f) display] + [else + (lambda (p port) + (print p port mode))])]) + (recur (str-v a-str) port)))) + (write (str "hello world") out) + (flush-output out) + (test "hello world" read in)) + + ;; -------------------------------------------------- (report-errs)