| OLD | NEW |
| 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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 TEMP_FAILURE_RETRY(close(exec_control[0])); | 526 TEMP_FAILURE_RETRY(close(exec_control[0])); |
| 527 | 527 |
| 528 // Return error code if any failures. | 528 // Return error code if any failures. |
| 529 if (bytes_read != 0) { | 529 if (bytes_read != 0) { |
| 530 TEMP_FAILURE_RETRY(close(read_in[0])); | 530 TEMP_FAILURE_RETRY(close(read_in[0])); |
| 531 TEMP_FAILURE_RETRY(close(read_in[1])); | 531 TEMP_FAILURE_RETRY(close(read_in[1])); |
| 532 TEMP_FAILURE_RETRY(close(read_err[0])); | 532 TEMP_FAILURE_RETRY(close(read_err[0])); |
| 533 TEMP_FAILURE_RETRY(close(read_err[1])); | 533 TEMP_FAILURE_RETRY(close(read_err[1])); |
| 534 TEMP_FAILURE_RETRY(close(write_out[0])); | 534 TEMP_FAILURE_RETRY(close(write_out[0])); |
| 535 TEMP_FAILURE_RETRY(close(write_out[1])); | 535 TEMP_FAILURE_RETRY(close(write_out[1])); |
| 536 |
| 537 // Since exec() failed, we're not interested in the exit code. |
| 538 // We close the reading side of the exit code pipe here. |
| 539 // GetProcessExitCodes will get a broken pipe error when it tries to write |
| 540 // to the writing side of the pipe and it will ignore the error. |
| 541 TEMP_FAILURE_RETRY(close(*exit_event)); |
| 542 *exit_event = -1; |
| 543 |
| 536 if (bytes_read == -1) { | 544 if (bytes_read == -1) { |
| 537 return errno; // Read failed. | 545 return errno; // Read failed. |
| 538 } else { | 546 } else { |
| 539 return child_errno; // Exec failed. | 547 return child_errno; // Exec failed. |
| 540 } | 548 } |
| 541 } | 549 } |
| 542 | 550 |
| 543 FDUtils::SetNonBlocking(read_in[0]); | 551 FDUtils::SetNonBlocking(read_in[0]); |
| 544 *in = read_in[0]; | 552 *in = read_in[0]; |
| 545 TEMP_FAILURE_RETRY(close(read_in[1])); | 553 TEMP_FAILURE_RETRY(close(read_in[1])); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 570 | 578 |
| 571 | 579 |
| 572 intptr_t Process::CurrentProcessId() { | 580 intptr_t Process::CurrentProcessId() { |
| 573 return static_cast<intptr_t>(getpid()); | 581 return static_cast<intptr_t>(getpid()); |
| 574 } | 582 } |
| 575 | 583 |
| 576 } // namespace bin | 584 } // namespace bin |
| 577 } // namespace dart | 585 } // namespace dart |
| 578 | 586 |
| 579 #endif // defined(TARGET_OS_ANDROID) | 587 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |