9983a0d
--- src/c/file.d.orig	2020-04-24 04:54:52.000000000 -0600
9983a0d
+++ src/c/file.d	2020-07-07 08:27:48.474295560 -0600
9983a0d
@@ -3536,7 +3536,8 @@ output_stream_write_byte8(cl_object strm
9983a0d
   ecl_disable_interrupts();
9983a0d
   do {
9983a0d
     out = fwrite(c, sizeof(char), n, IO_STREAM_FILE(strm));
9983a0d
-  } while (out < n && restartable_io_error(strm, "fwrite"));
9983a0d
+    /* Ignore write errors to stderr to avoid an infinite loop */
9983a0d
+  } while (out < n && (IO_STREAM_FILE(strm) != stderr) && restartable_io_error(strm, "fwrite"));
9983a0d
   ecl_enable_interrupts();
9983a0d
   return out;
9983a0d
 }