diff -ru src/src/c/file.d b/src/c/file.d
--- src/src/c/file.d 2012-12-07 22:01:02.000000000 +0100
+++ b/src/c/file.d 2013-04-10 09:07:24.537513659 +0200
@@ -3335,7 +3335,8 @@
ecl_disable_interrupts();
do {
out = fwrite(c, sizeof(char), n, IO_STREAM_FILE(strm));
- } while (out < n && restartable_io_error(strm, "fwrite"));
+ /* Ignore write errors to stderr to avoid an infinite loop */
+ } while (out < n && (IO_STREAM_FILE(strm) != stderr) && restartable_io_error(strm, "fwrite"));
ecl_enable_interrupts();
return out;
}