| 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 "base/process/launch.h" | 5 #include "base/process/launch.h" |
| 6 | 6 |
| 7 #include <dirent.h> | 7 #include <dirent.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <sched.h> | 10 #include <sched.h> |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 656 } |
| 657 | 657 |
| 658 bool GetAppOutputAndError(const CommandLine& cl, std::string* output) { | 658 bool GetAppOutputAndError(const CommandLine& cl, std::string* output) { |
| 659 // Run |execve()| with the current environment. | 659 // Run |execve()| with the current environment. |
| 660 int exit_code; | 660 int exit_code; |
| 661 bool result = | 661 bool result = |
| 662 GetAppOutputInternal(cl.argv(), nullptr, true, output, true, &exit_code); | 662 GetAppOutputInternal(cl.argv(), nullptr, true, output, true, &exit_code); |
| 663 return result && exit_code == EXIT_SUCCESS; | 663 return result && exit_code == EXIT_SUCCESS; |
| 664 } | 664 } |
| 665 | 665 |
| 666 bool GetAppOutputAndError(const std::vector<std::string>& argv, |
| 667 std::string* output) { |
| 668 int exit_code; |
| 669 bool result = |
| 670 GetAppOutputInternal(argv, nullptr, true, output, true, &exit_code); |
| 671 return result && exit_code == EXIT_SUCCESS; |
| 672 } |
| 673 |
| 666 bool GetAppOutputWithExitCode(const CommandLine& cl, | 674 bool GetAppOutputWithExitCode(const CommandLine& cl, |
| 667 std::string* output, | 675 std::string* output, |
| 668 int* exit_code) { | 676 int* exit_code) { |
| 669 // Run |execve()| with the current environment. | 677 // Run |execve()| with the current environment. |
| 670 return GetAppOutputInternal(cl.argv(), nullptr, false, output, true, | 678 return GetAppOutputInternal(cl.argv(), nullptr, false, output, true, |
| 671 exit_code); | 679 exit_code); |
| 672 } | 680 } |
| 673 | 681 |
| 674 #endif // !defined(OS_NACL_NONSFI) | 682 #endif // !defined(OS_NACL_NONSFI) |
| 675 | 683 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 jmp_buf env; | 766 jmp_buf env; |
| 759 if (setjmp(env) == 0) { | 767 if (setjmp(env) == 0) { |
| 760 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); | 768 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); |
| 761 } | 769 } |
| 762 | 770 |
| 763 return 0; | 771 return 0; |
| 764 } | 772 } |
| 765 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) | 773 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) |
| 766 | 774 |
| 767 } // namespace base | 775 } // namespace base |
| OLD | NEW |