Windows: Fix --enable-logging to not disable logging when stderr is a pipe
Before this change, when chrome.exe is run under Buildbot or under
Cygwin's default terminal (mintty), passing --enable-logging (which
calls RouteStdioToConsole()) has the unfortunate side effect of
disabling logging from the browser process. In these cases, stderr is
a pipe handle, not a Windows console, and opening CONOUT$ gives a
console handle whose output doesn't go anywhere.
(Note that this does not apply to browser_tests.exe, which has
subsystem=console in its headers. In this case, the browser process
is already attached to a non-visible console at startup, and
RouteStdioToConsole() exits via the ERROR_ACCESS_DENIED path.)
We fix this by making RouteStdioToConsole() a no-op if stdout/stderr
already point to valid streams.
BUG=169941
TEST=Ran chrome.exe and browser_tests.exe from both Cygwin mintty and
the Windows console, with some extra logging added; checked that
logging is displayed.
Review URL: https://codereview.chromium.org/12038059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178656 0039d316-1c4b-4281-b951-d872f2087c98
1 file changed