Lock output stream in test-output.