[gimp] app: fix no console output on Windows for --dump-gimprc



commit 970665f2b260a2cc539b9ffe3ed1e22880d46a58
Author: Jacob Boerema <jgboerema gmail com>
Date:   Tue Oct 12 11:50:11 2021 -0400

    app: fix no console output on Windows for --dump-gimprc
    
    On Windows the --dump-gimprc, --dump-gimprc-system and --dump-gimprc-manpage
    command line parameters do not produce any console output.
    Apparently we need to request the handle for stdout instead of directly
    using1 for stdout.
    
    After this commit there still is a problem when redirecting output to a
    file. It seems that the buffer where stdout is stored is not flushed or
    the file pointer is reset to 0 every time causing overwrites instead of
    appending to the file.

 app/config/gimpconfig-dump.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/app/config/gimpconfig-dump.c b/app/config/gimpconfig-dump.c
index 014d8a0972..659dbe2ebb 100644
--- a/app/config/gimpconfig-dump.c
+++ b/app/config/gimpconfig-dump.c
@@ -28,6 +28,7 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 #ifdef G_OS_WIN32
+#include <io.h> /* get_osfhandle */
 #include <gio/gwin32outputstream.h>
 #else
 #include <gio/gunixoutputstream.h>
@@ -70,7 +71,7 @@ gimp_config_dump (GObject              *gimp,
                      NULL);
 
 #ifdef G_OS_WIN32
-  output = g_win32_output_stream_new ((gpointer) 1, FALSE);
+  output = g_win32_output_stream_new ((gpointer) _get_osfhandle (fileno (stdout)), FALSE);
 #else
   output = g_unix_output_stream_new (1, FALSE);
 #endif


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