Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/test/local_test_server.h" | 5 #include "net/test/local_test_server.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <wincrypt.h> | 8 #include <wincrypt.h> |
| 9 | 9 |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 bool LocalTestServer::LaunchPython(const FilePath& testserver_path) { | 87 bool LocalTestServer::LaunchPython(const FilePath& testserver_path) { |
| 88 FilePath python_exe; | 88 FilePath python_exe; |
| 89 if (!PathService::Get(base::DIR_SOURCE_ROOT, &python_exe)) | 89 if (!PathService::Get(base::DIR_SOURCE_ROOT, &python_exe)) |
| 90 return false; | 90 return false; |
| 91 python_exe = python_exe | 91 python_exe = python_exe |
| 92 .Append(FILE_PATH_LITERAL("third_party")) | 92 .Append(FILE_PATH_LITERAL("third_party")) |
| 93 .Append(FILE_PATH_LITERAL("python_26")) | 93 .Append(FILE_PATH_LITERAL("python_26")) |
| 94 .Append(FILE_PATH_LITERAL("python.exe")); | 94 .Append(FILE_PATH_LITERAL("python.exe")); |
| 95 | 95 |
| 96 CommandLine python_command(python_exe); | 96 CommandLine python_command(python_exe); |
| 97 | |
| 98 // Make python stdout and stderr unbuffered, to prevent incomplete stderr on | |
|
Paweł Hajdan Jr.
2012/04/17 06:38:05
Do not duplicate this code if possible (and it is)
mattm
2012/04/18 00:20:00
Done.
| |
| 99 // win bots, and also fix mixed up ordering of stdout and stderr. | |
| 100 python_command.AppendSwitch("-u"); | |
| 101 | |
| 97 python_command.AppendArgPath(testserver_path); | 102 python_command.AppendArgPath(testserver_path); |
| 98 if (!AddCommandLineArguments(&python_command)) | 103 if (!AddCommandLineArguments(&python_command)) |
| 99 return false; | 104 return false; |
| 100 | 105 |
| 101 HANDLE child_read = NULL; | 106 HANDLE child_read = NULL; |
| 102 HANDLE child_write = NULL; | 107 HANDLE child_write = NULL; |
| 103 if (!CreatePipe(&child_read, &child_write, NULL, 0)) { | 108 if (!CreatePipe(&child_read, &child_write, NULL, 0)) { |
| 104 PLOG(ERROR) << "Failed to create pipe"; | 109 PLOG(ERROR) << "Failed to create pipe"; |
| 105 return false; | 110 return false; |
| 106 } | 111 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 | 174 |
| 170 if (!ParseServerData(server_data)) { | 175 if (!ParseServerData(server_data)) { |
| 171 LOG(ERROR) << "Could not parse server_data: " << server_data; | 176 LOG(ERROR) << "Could not parse server_data: " << server_data; |
| 172 return false; | 177 return false; |
| 173 } | 178 } |
| 174 | 179 |
| 175 return true; | 180 return true; |
| 176 } | 181 } |
| 177 | 182 |
| 178 } // namespace net | 183 } // namespace net |
| 179 | |
| OLD | NEW |