| Index: base/process/launch_win.cc
|
| diff --git a/base/process/launch_win.cc b/base/process/launch_win.cc
|
| index bb51a69b1b2e7b7986d87c4cac2fbc73a41930f0..f55c96841503b34f17ecf8649ee55078861412d4 100644
|
| --- a/base/process/launch_win.cc
|
| +++ b/base/process/launch_win.cc
|
| @@ -150,7 +150,14 @@ void RouteStdioToConsole(bool create_console_if_not_found) {
|
| // _fileno(stdout) will return -2 (_NO_CONSOLE_FILENO) if stdout was
|
| // invalid.
|
| if (_fileno(stdout) >= 0 || _fileno(stderr) >= 0) {
|
| - return;
|
| + // _fileno was broken for SUBSYSTEM:WINDOWS from VS2010 to VS2012/2013.
|
| + // http://crbug.com/358267. Confirm that the underlying HANDLE is valid
|
| + // before aborting.
|
| +
|
| + intptr_t stdout_handle = _get_osfhandle(_fileno(stdout));
|
| + intptr_t stderr_handle = _get_osfhandle(_fileno(stderr));
|
| + if (stdout_handle >= 0 || stderr_handle >= 0)
|
| + return;
|
| }
|
|
|
| if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
|
|
|