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