Arc Forumnew | comments | leaders | submitlogin
stdout in defop
2 points by highCs 3312 days ago | 2 comments
Hi,

How can I print on the terminal within a defop (http route)? Within a defop, pr outputs in the socket, how can I redirect temporarily stdout to the terminal then?

Thanks



3 points by akkartik 3312 days ago | link

You should be able to save the real stdout outside defop (say in a global variable) and then use it within. For example, this works:

  (let real-stdout (stdout)
    (w/stdout (stderr)
      (prn "a")
      (w/stdout real-stdout
        (prn "b"))))
Does that make sense? Let me know if you have more questions.

-----

2 points by highCs 3312 days ago | link

That works nicely. Thank you.

-----