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