OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/test/launcher/test_launcher.h" | 5 #include "base/test/launcher/test_launcher.h" |
6 | 6 |
7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 FILE_ATTRIBUTE_TEMPORARY, | 376 FILE_ATTRIBUTE_TEMPORARY, |
377 NULL)); | 377 NULL)); |
378 CHECK(handle.IsValid()); | 378 CHECK(handle.IsValid()); |
379 options.inherit_handles = true; | 379 options.inherit_handles = true; |
380 options.stdin_handle = INVALID_HANDLE_VALUE; | 380 options.stdin_handle = INVALID_HANDLE_VALUE; |
381 options.stdout_handle = handle.Get(); | 381 options.stdout_handle = handle.Get(); |
382 options.stderr_handle = handle.Get(); | 382 options.stderr_handle = handle.Get(); |
383 } | 383 } |
384 #elif defined(OS_POSIX) | 384 #elif defined(OS_POSIX) |
385 options.new_process_group = true; | 385 options.new_process_group = true; |
| 386 #if defined(OS_LINUX) |
| 387 options.kill_on_parent_death = true; |
| 388 #endif // defined(OS_LINUX) |
386 | 389 |
387 FileHandleMappingVector fds_mapping; | 390 FileHandleMappingVector fds_mapping; |
388 ScopedFD output_file_fd; | 391 ScopedFD output_file_fd; |
389 | 392 |
390 if (redirect_stdio) { | 393 if (redirect_stdio) { |
391 output_file_fd.reset(open(output_file.value().c_str(), O_RDWR)); | 394 output_file_fd.reset(open(output_file.value().c_str(), O_RDWR)); |
392 CHECK(output_file_fd.is_valid()); | 395 CHECK(output_file_fd.is_valid()); |
393 | 396 |
394 fds_mapping.push_back(std::make_pair(output_file_fd.get(), STDOUT_FILENO)); | 397 fds_mapping.push_back(std::make_pair(output_file_fd.get(), STDOUT_FILENO)); |
395 fds_mapping.push_back(std::make_pair(output_file_fd.get(), STDERR_FILENO)); | 398 fds_mapping.push_back(std::make_pair(output_file_fd.get(), STDERR_FILENO)); |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 } | 1081 } |
1079 | 1082 |
1080 std::string snippet(full_output.substr(run_pos)); | 1083 std::string snippet(full_output.substr(run_pos)); |
1081 if (end_pos != std::string::npos) | 1084 if (end_pos != std::string::npos) |
1082 snippet = full_output.substr(run_pos, end_pos - run_pos); | 1085 snippet = full_output.substr(run_pos, end_pos - run_pos); |
1083 | 1086 |
1084 return snippet; | 1087 return snippet; |
1085 } | 1088 } |
1086 | 1089 |
1087 } // namespace base | 1090 } // namespace base |
OLD | NEW |