(call-with-output-file "/tmp/test.txt" (lambda (out) (with-error-output-to-port out (lambda () (display "foobar" (current-error-port)) (newline (current-error-port))))))