Bug 787313 - Add back code that was erroneously reverted. r=ochameau
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 26 Sep 2012 18:56:49 -0400
changeset 108318 e4be135eff48ba0d22309e8926b91ba290e6c423
parent 108317 987f0423f403b837cabcf872aba7742eb20af2ce
child 108319 d73da596f3fd7093e72946faed3da882bb1ade01
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersochameau
bugs787313
milestone18.0a1
Bug 787313 - Add back code that was erroneously reverted. r=ochameau
toolkit/xre/nsNativeAppSupportWin.cpp
--- a/toolkit/xre/nsNativeAppSupportWin.cpp
+++ b/toolkit/xre/nsNativeAppSupportWin.cpp
@@ -400,19 +400,21 @@ nsNativeAppSupportWin::CheckConsole() {
             // so that stdio will be displayed in it.
             if (AttachConsole(ATTACH_PARENT_PROCESS)) {
                 // Change std handles to refer to new console handles.
                 // Before doing so, ensure that stdout/stderr haven't been
                 // redirected to a valid file
                 if (_fileno(stdout) == -1 ||
                     _get_osfhandle(fileno(stdout)) == -1)
                     freopen("CONOUT$", "w", stdout);
+                // Merge stderr into CONOUT$ since there isn't any `CONERR$`.
+                // http://msdn.microsoft.com/en-us/library/windows/desktop/ms683231%28v=vs.85%29.aspx
                 if (_fileno(stderr) == -1 ||
                     _get_osfhandle(fileno(stderr)) == -1)
-                    freopen("CONERR$", "w", stderr);
+                    freopen("CONOUT$", "w", stderr);
                 if (_fileno(stdin) == -1 || _get_osfhandle(fileno(stdin)) == -1)
                     freopen("CONIN$", "r", stdin);
             }
         }
     }
 
     return;
 }