Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: runtime/bin/process_android.cc

Issue 23494048: Always wait for child processes when forked, even if the process failed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/process_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "bin/process.h" 8 #include "bin/process.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 if (program_environment != NULL) { 399 if (program_environment != NULL) {
400 environ = program_environment; 400 environ = program_environment;
401 } 401 }
402 402
403 TEMP_FAILURE_RETRY( 403 TEMP_FAILURE_RETRY(
404 execvp(path, const_cast<char* const*>(program_arguments))); 404 execvp(path, const_cast<char* const*>(program_arguments)));
405 405
406 ReportChildError(exec_control[1]); 406 ReportChildError(exec_control[1]);
407 } 407 }
408 408
409 // Be sure to listen for exit-codes, now we have a child-process.
410 ExitCodeHandler::ProcessStarted();
411
409 // The arguments and environment for the spawned process are not needed 412 // The arguments and environment for the spawned process are not needed
410 // any longer. 413 // any longer.
411 delete[] program_arguments; 414 delete[] program_arguments;
412 delete[] program_environment; 415 delete[] program_environment;
413 416
414 int event_fds[2]; 417 int event_fds[2];
415 result = TEMP_FAILURE_RETRY(pipe(event_fds)); 418 result = TEMP_FAILURE_RETRY(pipe(event_fds));
416 if (result < 0) { 419 if (result < 0) {
417 SetChildOsErrorMessage(os_error_message); 420 SetChildOsErrorMessage(os_error_message);
418 TEMP_FAILURE_RETRY(close(read_in[0])); 421 TEMP_FAILURE_RETRY(close(read_in[0]));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 FDUtils::SetNonBlocking(read_in[0]); 488 FDUtils::SetNonBlocking(read_in[0]);
486 *in = read_in[0]; 489 *in = read_in[0];
487 TEMP_FAILURE_RETRY(close(read_in[1])); 490 TEMP_FAILURE_RETRY(close(read_in[1]));
488 FDUtils::SetNonBlocking(write_out[1]); 491 FDUtils::SetNonBlocking(write_out[1]);
489 *out = write_out[1]; 492 *out = write_out[1];
490 TEMP_FAILURE_RETRY(close(write_out[0])); 493 TEMP_FAILURE_RETRY(close(write_out[0]));
491 FDUtils::SetNonBlocking(read_err[0]); 494 FDUtils::SetNonBlocking(read_err[0]);
492 *err = read_err[0]; 495 *err = read_err[0];
493 TEMP_FAILURE_RETRY(close(read_err[1])); 496 TEMP_FAILURE_RETRY(close(read_err[1]));
494 497
495 // Be sure to listen for exit-codes, now we have a child-process.
496 ExitCodeHandler::ProcessStarted();
497
498 *id = pid; 498 *id = pid;
499 return 0; 499 return 0;
500 } 500 }
501 501
502 502
503 class BufferList: public BufferListBase { 503 class BufferList: public BufferListBase {
504 public: 504 public:
505 bool Read(int fd, intptr_t available) { 505 bool Read(int fd, intptr_t available) {
506 // Read all available bytes. 506 // Read all available bytes.
507 while (available > 0) { 507 while (available > 0) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 628
629 629
630 intptr_t Process::CurrentProcessId() { 630 intptr_t Process::CurrentProcessId() {
631 return static_cast<intptr_t>(getpid()); 631 return static_cast<intptr_t>(getpid());
632 } 632 }
633 633
634 } // namespace bin 634 } // namespace bin
635 } // namespace dart 635 } // namespace dart
636 636
637 #endif // defined(TARGET_OS_ANDROID) 637 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/process_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698