[librsvg: 1/2] Do not use Win32OutputStream for stdout




commit 29963c9dd4051da197cf6a229ab3eebf61fbfe56
Author: Michael Howell <michael notriddle com>
Date:   Fri Dec 3 13:48:50 2021 -0700

    Do not use Win32OutputStream for stdout
    
    It works fine with a console or a pipe, but when used with file redirect,
    it gets buggy.
    
    Fixes #812

 src/bin/rsvg-convert.rs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/bin/rsvg-convert.rs b/src/bin/rsvg-convert.rs
index d3667b9f..a1d19c7f 100644
--- a/src/bin/rsvg-convert.rs
+++ b/src/bin/rsvg-convert.rs
@@ -9,7 +9,7 @@ use gio::{UnixInputStream, UnixOutputStream};
 
 #[cfg(windows)]
 mod windows_imports {
-    pub use gio::{Win32InputStream, Win32OutputStream};
+    pub use gio::{Win32InputStream, WriteOutputStream};
     pub use glib::ffi::gboolean;
     pub use glib::translate::*;
     pub use libc::c_void;
@@ -372,7 +372,10 @@ impl Stdout {
 
     #[cfg(windows)]
     pub fn stream() -> OutputStream {
-        let stream = unsafe { Win32OutputStream::with_handle(io::stdout()) };
+        // Ideally, we could use a Win32OutputStream, but when it's used with a file redirect,
+        // it gets buggy.
+        // https://gitlab.gnome.org/GNOME/librsvg/-/issues/812
+        let stream = WriteOutputStream::new(io::stdout());
         stream.upcast::<OutputStream>()
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]