OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <dirent.h> | 5 #include <dirent.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // off chance that it's already set. | 267 // off chance that it's already set. |
268 unsetenv("SBX_D"); | 268 unsetenv("SBX_D"); |
269 | 269 |
270 CloseSuperfluousFds(fd_shuffle); | 270 CloseSuperfluousFds(fd_shuffle); |
271 | 271 |
272 scoped_array<char*> argv_cstr(new char*[argv.size() + 1]); | 272 scoped_array<char*> argv_cstr(new char*[argv.size() + 1]); |
273 for (size_t i = 0; i < argv.size(); i++) | 273 for (size_t i = 0; i < argv.size(); i++) |
274 argv_cstr[i] = const_cast<char*>(argv[i].c_str()); | 274 argv_cstr[i] = const_cast<char*>(argv[i].c_str()); |
275 argv_cstr[argv.size()] = NULL; | 275 argv_cstr[argv.size()] = NULL; |
276 execvp(argv_cstr[0], argv_cstr.get()); | 276 execvp(argv_cstr[0], argv_cstr.get()); |
277 LOG(ERROR) << "LaunchApp: exec failed!, argv_cstr[0] " << argv_cstr[0] | 277 LOG(ERROR) << "LaunchApp: execvp(" << argv_cstr[0] << ") failed: " |
278 << ", errno " << errno; | 278 << strerror(errno); |
279 _exit(127); | 279 _exit(127); |
280 } else { | 280 } else { |
281 // Parent process | 281 // Parent process |
282 if (wait) | 282 if (wait) |
283 HANDLE_EINTR(waitpid(pid, 0, 0)); | 283 HANDLE_EINTR(waitpid(pid, 0, 0)); |
284 | 284 |
285 if (process_handle) | 285 if (process_handle) |
286 *process_handle = pid; | 286 *process_handle = pid; |
287 } | 287 } |
288 | 288 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 const ProcessFilter* filter) { | 635 const ProcessFilter* filter) { |
636 bool exited_cleanly = | 636 bool exited_cleanly = |
637 WaitForProcessesToExit(executable_name, wait_milliseconds, | 637 WaitForProcessesToExit(executable_name, wait_milliseconds, |
638 filter); | 638 filter); |
639 if (!exited_cleanly) | 639 if (!exited_cleanly) |
640 KillProcesses(executable_name, exit_code, filter); | 640 KillProcesses(executable_name, exit_code, filter); |
641 return exited_cleanly; | 641 return exited_cleanly; |
642 } | 642 } |
643 | 643 |
644 } // namespace base | 644 } // namespace base |
OLD | NEW |