strm close exn ex added by kon on Wed Jul 12 01:47:49 2023

(define (read-file-stream filename)
  (let ([f (open-input-file filename)]
        (exn #f))
    (let read-loop ()
      (define line
        (handle-exceptions rdexn
          (begin 
            (set! exn rdexn) ;save what happened
            #!eof)           ;ensure file closed
          (read-line f)))
      (print "read line")
      (if (eof-object? line)
        (begin
          (close-input-port f)
          ;NOTE do something w/ exn
          stream-null)
        (stream-cons line (read-loop))))))