| 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 <crt_externs.h> // NOLINT | |
| 11 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| 12 #include <fcntl.h> // NOLINT | 11 #include <fcntl.h> // NOLINT |
| 13 #include <poll.h> // NOLINT | 12 #include <poll.h> // NOLINT |
| 14 #include <signal.h> // NOLINT | 13 #include <signal.h> // NOLINT |
| 15 #include <stdio.h> // NOLINT | 14 #include <stdio.h> // NOLINT |
| 16 #include <stdlib.h> // NOLINT | 15 #include <stdlib.h> // NOLINT |
| 17 #include <string.h> // NOLINT | 16 #include <string.h> // NOLINT |
| 18 #include <unistd.h> // NOLINT | 17 #include <unistd.h> // NOLINT |
| 19 | 18 |
| 20 #include "bin/fdutils.h" | 19 #include "bin/fdutils.h" |
| 21 #include "bin/lockers.h" | 20 #include "bin/lockers.h" |
| 22 #include "bin/log.h" | 21 #include "bin/log.h" |
| 23 #include "bin/thread.h" | 22 #include "bin/thread.h" |
| 24 | 23 |
| 25 #include "platform/signal_blocker.h" | 24 #include "platform/signal_blocker.h" |
| 26 | 25 |
| 27 | 26 |
| 27 extern char **environ; |
| 28 |
| 28 | 29 |
| 29 namespace dart { | 30 namespace dart { |
| 30 namespace bin { | 31 namespace bin { |
| 31 | 32 |
| 32 // ProcessInfo is used to map a process id to the file descriptor for | 33 // ProcessInfo is used to map a process id to the file descriptor for |
| 33 // the pipe used to communicate the exit code of the process to Dart. | 34 // the pipe used to communicate the exit code of the process to Dart. |
| 34 // ProcessInfo objects are kept in the static singly-linked | 35 // ProcessInfo objects are kept in the static singly-linked |
| 35 // ProcessInfoList. | 36 // ProcessInfoList. |
| 36 class ProcessInfo { | 37 class ProcessInfo { |
| 37 public: | 38 public: |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 ReportChildError(exec_control[1]); | 467 ReportChildError(exec_control[1]); |
| 467 } | 468 } |
| 468 VOID_TEMP_FAILURE_RETRY(close(read_err[1])); | 469 VOID_TEMP_FAILURE_RETRY(close(read_err[1])); |
| 469 | 470 |
| 470 if (working_directory != NULL && | 471 if (working_directory != NULL && |
| 471 TEMP_FAILURE_RETRY(chdir(working_directory)) == -1) { | 472 TEMP_FAILURE_RETRY(chdir(working_directory)) == -1) { |
| 472 ReportChildError(exec_control[1]); | 473 ReportChildError(exec_control[1]); |
| 473 } | 474 } |
| 474 | 475 |
| 475 if (program_environment != NULL) { | 476 if (program_environment != NULL) { |
| 476 // On MacOS you have to do a bit of magic to get to the | |
| 477 // environment strings. | |
| 478 char** environ = *(_NSGetEnviron()); | |
| 479 environ = program_environment; | 477 environ = program_environment; |
| 480 } | 478 } |
| 481 | 479 |
| 482 VOID_TEMP_FAILURE_RETRY( | 480 VOID_TEMP_FAILURE_RETRY( |
| 483 execvp(path, const_cast<char* const*>(program_arguments))); | 481 execvp(path, const_cast<char* const*>(program_arguments))); |
| 484 | 482 |
| 485 ReportChildError(exec_control[1]); | 483 ReportChildError(exec_control[1]); |
| 486 } | 484 } |
| 487 } | 485 } |
| 488 | 486 |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 bzero(&act, sizeof(act)); | 885 bzero(&act, sizeof(act)); |
| 888 act.sa_handler = SIG_DFL; | 886 act.sa_handler = SIG_DFL; |
| 889 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); | 887 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); |
| 890 } | 888 } |
| 891 } | 889 } |
| 892 | 890 |
| 893 } // namespace bin | 891 } // namespace bin |
| 894 } // namespace dart | 892 } // namespace dart |
| 895 | 893 |
| 896 #endif // defined(TARGET_OS_MACOS) | 894 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |