| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/test/chromedriver/chrome_launcher.h" | 5 #include "chrome/test/chromedriver/chrome_launcher.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 if (capabilities.detach) | 248 if (capabilities.detach) |
| 249 options.new_process_group = true; | 249 options.new_process_group = true; |
| 250 #endif | 250 #endif |
| 251 | 251 |
| 252 #if defined(OS_POSIX) | 252 #if defined(OS_POSIX) |
| 253 base::FileHandleMappingVector no_stderr; | 253 base::FileHandleMappingVector no_stderr; |
| 254 base::ScopedFD devnull; | 254 base::ScopedFD devnull; |
| 255 if (!CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { | 255 if (!CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { |
| 256 // Redirect stderr to /dev/null, so that Chrome log spew doesn't confuse | 256 // Redirect stderr to /dev/null, so that Chrome log spew doesn't confuse |
| 257 // users. | 257 // users. |
| 258 devnull.reset(open("/dev/null", O_WRONLY)); | 258 devnull.reset(HANDLE_EINTR(open("/dev/null", O_WRONLY))); |
| 259 if (!devnull.is_valid()) | 259 if (!devnull.is_valid()) |
| 260 return Status(kUnknownError, "couldn't open /dev/null"); | 260 return Status(kUnknownError, "couldn't open /dev/null"); |
| 261 no_stderr.push_back(std::make_pair(devnull.get(), STDERR_FILENO)); | 261 no_stderr.push_back(std::make_pair(devnull.get(), STDERR_FILENO)); |
| 262 options.fds_to_remap = &no_stderr; | 262 options.fds_to_remap = &no_stderr; |
| 263 } | 263 } |
| 264 #endif | 264 #endif |
| 265 | 265 |
| 266 #if defined(OS_WIN) | 266 #if defined(OS_WIN) |
| 267 std::string command_string = base::WideToUTF8(command.GetCommandLineString()); | 267 std::string command_string = base::WideToUTF8(command.GetCommandLineString()); |
| 268 #else | 268 #else |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 // Write empty "First Run" file, otherwise Chrome will wipe the default | 683 // Write empty "First Run" file, otherwise Chrome will wipe the default |
| 684 // profile that was written. | 684 // profile that was written. |
| 685 if (base::WriteFile( | 685 if (base::WriteFile( |
| 686 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 686 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { |
| 687 return Status(kUnknownError, "failed to write first run file"); | 687 return Status(kUnknownError, "failed to write first run file"); |
| 688 } | 688 } |
| 689 return Status(kOk); | 689 return Status(kOk); |
| 690 } | 690 } |
| 691 | 691 |
| 692 } // namespace internal | 692 } // namespace internal |
| OLD | NEW |