Hi,

I found bug in implementation stream-write-string for dual-channel-gray-stream class: lost last  #\Newline character.
Patch:

diff --git a/src/streams/gray/gray-stream-methods.lisp b/src/streams/gray/gray-stream-methods.lisp
index 43f4694..9d8b720 100644
--- a/src/streams/gray/gray-stream-methods.lisp
+++ b/src/streams/gray/gray-stream-methods.lisp
@@ -492,13 +492,13 @@
            (ef (external-format-of stream))
            (line-terminator (babel:external-format-eol-style ef)))
       (loop :for off1 := start :then (1+ off2)
-            :for nl-off := (position #\Newline string :start off1)
+            :for nl-off := (position #\Newline string :start off1 :end end)
             :for off2 := (or nl-off end)
-         :when nl-off :do (%write-line-terminator stream line-terminator)
          :when (> off2 off1) :do
          ;; FIXME: should probably convert directly to a foreign buffer?
          (setf octets (%to-octets string off1 off2 ef))
          (%write-simple-array-ub8 stream octets 0 (length octets))
+         :when nl-off :do (%write-line-terminator stream line-terminator)
          :while (< off2 end))))
   (values string))
 

Andrey