diff --git a/app/main.c b/app/main.c index 6ff266480c..39b0b3faed 100644 --- a/app/main.c +++ b/app/main.c @@ -955,8 +955,9 @@ gimp_attach_console_window (void) /* If run on native shell, attach to it */ if (AttachConsole (ATTACH_PARENT_PROCESS) != 0) { - freopen ("CONOUT$", "w", stdout); - freopen ("CONOUT$", "w", stderr); + /* 'r' is needed to prevent interleaving and '+' to support colors */ + freopen ("CONOUT$", "r+", stdout); + freopen ("CONOUT$", "r+", stderr); _flushall (); { diff --git a/libgimp/gimp.c b/libgimp/gimp.c index 4eb73a996a..a21a99f3ca 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -204,8 +204,9 @@ gimp_main (GType plug_in_type, /* Make plugins output available on console */ if (AttachConsole (ATTACH_PARENT_PROCESS) != 0 && ! g_getenv ("TERM") && ! g_getenv ("SHELL")) { - freopen ("CONOUT$", "w", stdout); - freopen ("CONOUT$", "w", stderr); + /* 'r' is needed to prevent interleaving and '+' to support colors */ + freopen ("CONOUT$", "r+", stdout); + freopen ("CONOUT$", "r+", stderr); _flushall (); }