Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: base/process/launch_win.cc

Issue 2810903002: Revert of Allow handles through for official builds too (partial revert) (patchset #3 id:40001 of h… (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/common/sandbox_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/launch_win.cc
diff --git a/base/process/launch_win.cc b/base/process/launch_win.cc
index 1349b3e4af3d101d4515e04d5ae081195e73016a..97b59a5bfe45f5cf9d4b779446b46bd43795ba53 100644
--- a/base/process/launch_win.cc
+++ b/base/process/launch_win.cc
@@ -142,7 +142,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)) {
« no previous file with comments | « no previous file | content/common/sandbox_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698