diff --git a/src/c/file.d b/src/c/file.d index 2d15d50f8..199f24c4f 100755 --- a/src/c/file.d +++ b/src/c/file.d @@ -3536,7 +3536,8 @@ output_stream_write_byte8(cl_object strm, unsigned char *c, cl_index n) 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; } -- 2.20.1