Revision: 19688
Author:   [email protected]
Date:     Thu Mar  6 11:55:47 2014 UTC
Log:      Fix VPrintHelper used on Windows.

VPrintHelper would silently ignore the stream given to it if application is in GUI mode (no console is attached) and redirect output to the debugger via OutputDebugString.

Such redirection makes sense only if passed stream is either stderr or stdout. Don't redirect any other stream to the debugger.

Reorder clauses in VPrintHelper to make condition more readable.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/177413006
http://code.google.com/p/v8/source/detail?r=19688

Modified:
 /branches/bleeding_edge/src/platform-win32.cc

=======================================
--- /branches/bleeding_edge/src/platform-win32.cc Tue Feb 25 13:53:06 2014 UTC +++ /branches/bleeding_edge/src/platform-win32.cc Thu Mar 6 11:55:47 2014 UTC
@@ -662,15 +662,15 @@


 static void VPrintHelper(FILE* stream, const char* format, va_list args) {
-  if (HasConsole()) {
-    vfprintf(stream, format, args);
-  } else {
+  if ((stream == stdout || stream == stderr) && !HasConsole()) {
     // It is important to use safe print here in order to avoid
     // overflowing the buffer. We might truncate the output, but this
     // does not crash.
     EmbeddedVector<char, 4096> buffer;
     OS::VSNPrintF(buffer, format, args);
     OutputDebugStringA(buffer.start());
+  } else {
+    vfprintf(stream, format, args);
   }
 }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to