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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 #endif | 480 #endif |
481 | 481 |
482 if (current_directory != nullptr) { | 482 if (current_directory != nullptr) { |
483 RAW_CHECK(chdir(current_directory) == 0); | 483 RAW_CHECK(chdir(current_directory) == 0); |
484 } | 484 } |
485 | 485 |
486 if (options.pre_exec_delegate != nullptr) { | 486 if (options.pre_exec_delegate != nullptr) { |
487 options.pre_exec_delegate->RunAsyncSafe(); | 487 options.pre_exec_delegate->RunAsyncSafe(); |
488 } | 488 } |
489 | 489 |
490 execvp(argv_cstr[0], argv_cstr.get()); | 490 const char* executable_path = !options.real_path.empty() ? |
| 491 options.real_path.value().c_str() : argv_cstr[0]; |
| 492 |
| 493 execvp(executable_path, argv_cstr.get()); |
491 | 494 |
492 RAW_LOG(ERROR, "LaunchProcess: failed to execvp:"); | 495 RAW_LOG(ERROR, "LaunchProcess: failed to execvp:"); |
493 RAW_LOG(ERROR, argv_cstr[0]); | 496 RAW_LOG(ERROR, argv_cstr[0]); |
494 _exit(127); | 497 _exit(127); |
495 } else { | 498 } else { |
496 // Parent process | 499 // Parent process |
497 if (options.wait) { | 500 if (options.wait) { |
498 // While this isn't strictly disk IO, waiting for another process to | 501 // While this isn't strictly disk IO, waiting for another process to |
499 // finish is the sort of thing ThreadRestrictions is trying to prevent. | 502 // finish is the sort of thing ThreadRestrictions is trying to prevent. |
500 base::ThreadRestrictions::AssertIOAllowed(); | 503 base::ThreadRestrictions::AssertIOAllowed(); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 jmp_buf env; | 742 jmp_buf env; |
740 if (setjmp(env) == 0) { | 743 if (setjmp(env) == 0) { |
741 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); | 744 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); |
742 } | 745 } |
743 | 746 |
744 return 0; | 747 return 0; |
745 } | 748 } |
746 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) | 749 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) |
747 | 750 |
748 } // namespace base | 751 } // namespace base |
OLD | NEW |