If I have a function that prints to (current-output-port)
, is there an easy way to run the function without it printing to the output port?
Previously, I've used /dev/null
as an output target:
(with-output-to-file "/dev/null" #:exists 'append
(lambda () (displayln "hello world")))
This is easy, but platform dependent. Also I'll sometimes forget the #:exists
flag.