Skip to content

println output during lazy-seq realization in with-eval-in corrupts return value #683

Closed
@martinklepsch

Description

@martinklepsch
#!/usr/bin/env boot

(set-env! :dependencies '[[org.slf4j/slf4j-nop "1.7.25"]])

(require 'boot.pod)

(defn expected-result? [data]
  (println "Testing with data" data "\n")
  (let [expected   (map #(do (println "Found a match") %) data)
        pod-result (boot.pod/with-eval-in (boot.pod/make-pod {})
                     (map #(do (println "Found a match") %) ~data))]
    (when-not (= expected pod-result)
      (println "EXPECTED:   " expected)
      (println "POD RESULT: " pod-result))
    (= expected pod-result)))

(if (expected-result? [{:name "match-beginning"}])
  (do (println "Success, values are equal") (System/exit 0))
  (do (println "Failure, values are different") (System/exit 1)))

To reproduce: copy the above into a file repro, make it executable chmod +x repro, run it ./repro.

I reproduced this issue with 2.6.0, 2.7.2 and 2.8.0-SNAPSHOT.

EDIT updated with more minimal repro. The key thing seems to be that something is printed during iteration over a sequence.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions