Chromium Code Reviews| Index: base/test/launcher/test_launcher.cc |
| diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc |
| index c25b00a3c5e157bebce14c317b5242c2a65a599d..7994b1544ce21f5cd57822ff12e46dbb843dda44 100644 |
| --- a/base/test/launcher/test_launcher.cc |
| +++ b/base/test/launcher/test_launcher.cc |
| @@ -14,6 +14,7 @@ |
| #include "base/environment.h" |
| #include "base/file_util.h" |
| #include "base/files/file_path.h" |
| +#include "base/files/scoped_file.h" |
| #include "base/format_macros.h" |
| #include "base/lazy_instance.h" |
| #include "base/logging.h" |
| @@ -244,16 +245,14 @@ void DoLaunchChildTestProcess( |
| options.new_process_group = true; |
| base::FileHandleMappingVector fds_mapping; |
| - file_util::ScopedFD output_file_fd_closer; |
| + base::ScopedFD output_file_fd; |
| if (redirect_stdio) { |
| - int output_file_fd = open(output_file.value().c_str(), O_RDWR); |
| - CHECK_GE(output_file_fd, 0); |
| + output_file_fd.reset(open(output_file.value().c_str(), O_RDWR)); |
| + CHECK(output_file_fd.is_valid()); |
| - output_file_fd_closer.reset(&output_file_fd); |
| - |
| - fds_mapping.push_back(std::make_pair(output_file_fd, STDOUT_FILENO)); |
| - fds_mapping.push_back(std::make_pair(output_file_fd, STDERR_FILENO)); |
| + fds_mapping.push_back(std::make_pair(output_file_fd.get(), STDOUT_FILENO)); |
| + fds_mapping.push_back(std::make_pair(output_file_fd.get(), STDERR_FILENO)); |
| options.fds_to_remap = &fds_mapping; |
| } |
| #endif |
| @@ -267,7 +266,7 @@ void DoLaunchChildTestProcess( |
| FlushFileBuffers(handle.Get()); |
| handle.Close(); |
| #elif defined(OS_POSIX) |
| - output_file_fd_closer.reset(); |
| + output_file_fd.reset(); |
|
viettrungluu
2014/03/12 19:47:23
Could you fix the indentation here as a drive-by?
brettw
2014/03/12 20:45:30
Done
|
| #endif |
| } |