diff --git a/collects/2htdp/batch-io.rkt b/collects/2htdp/batch-io.rkt index 90a8c5f3a3..ce17fc61c6 100644 --- a/collects/2htdp/batch-io.rkt +++ b/collects/2htdp/batch-io.rkt @@ -63,7 +63,7 @@ (map string (read-chunks f read-char drop-last-newline))) (def-reader (read-lines f) - (read-chunks f read-line reverse)) + (read-chunks f *read-line reverse)) (def-reader (read-words f) (read-words/line/internal f append)) @@ -74,7 +74,7 @@ (read-words/line/internal f cons)) (define (read-words/line/internal f combine) - (define lines (read-chunks f read-line (lambda (x) x))) + (define lines (read-chunks f *read-line (lambda (x) x))) (foldl (lambda (f r) (define fst (filter (compose not (curry string=? "")) (split f))) (combine fst r)) @@ -87,6 +87,9 @@ (check-proc 'read-csv-file row 1 "one argument" "row") (read-csv-file/func f row)) +(define (*read-line) + (read-line (current-input-port) 'any)) + ;; ----------------------------------------------------------------------------- ;; tester diff --git a/collects/2htdp/tests/batch-io2.rkt b/collects/2htdp/tests/batch-io2.rkt new file mode 100644 index 0000000000..6401558b1a --- /dev/null +++ b/collects/2htdp/tests/batch-io2.rkt @@ -0,0 +1,17 @@ +#lang racket + +;; test for pr11445 + +(require 2htdp/batch-io) + +(with-output-to-file "batch-io2.txt" + (lambda () + (display "hello") + (display #\return) + (display #\linefeed)) + #:exists 'replace) + +(read-lines "batch-io2.txt") + + + diff --git a/collects/2htdp/tests/batch-io2.txt b/collects/2htdp/tests/batch-io2.txt new file mode 100644 index 0000000000..ef0493b275 --- /dev/null +++ b/collects/2htdp/tests/batch-io2.txt @@ -0,0 +1 @@ +hello