| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 #include "bin/io_buffer.h" | 6 #include "bin/io_buffer.h" |
| 7 #include "bin/platform.h" | 7 #include "bin/platform.h" |
| 8 #include "bin/process.h" | 8 #include "bin/process.h" |
| 9 #include "bin/socket.h" | 9 #include "bin/socket.h" |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 delete[] string_args; | 152 delete[] string_args; |
| 153 delete[] string_environment; | 153 delete[] string_environment; |
| 154 free(os_error_message); | 154 free(os_error_message); |
| 155 Dart_SetReturnValue(args, Dart_NewBoolean(error_code == 0)); | 155 Dart_SetReturnValue(args, Dart_NewBoolean(error_code == 0)); |
| 156 } | 156 } |
| 157 | 157 |
| 158 | 158 |
| 159 void FUNCTION_NAME(Process_Wait)(Dart_NativeArguments args) { | 159 void FUNCTION_NAME(Process_Wait)(Dart_NativeArguments args) { |
| 160 Dart_Handle process = Dart_GetNativeArgument(args, 0); | 160 Dart_Handle process = Dart_GetNativeArgument(args, 0); |
| 161 Dart_Handle stdin_handle = Dart_GetNativeArgument(args, 1); | 161 intptr_t process_stdin = |
| 162 Dart_Handle stdout_handle = Dart_GetNativeArgument(args, 2); | 162 Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 1)); |
| 163 Dart_Handle stderr_handle = Dart_GetNativeArgument(args, 3); | 163 intptr_t process_stdout = |
| 164 Dart_Handle exit_handle = Dart_GetNativeArgument(args, 4); | 164 Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 2)); |
| 165 intptr_t process_stdin; | 165 intptr_t process_stderr = |
| 166 intptr_t process_stdout; | 166 Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 3)); |
| 167 intptr_t process_stderr; | 167 intptr_t exit_event = |
| 168 intptr_t exit_event; | 168 Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 4)); |
| 169 Socket::GetSocketIdNativeField(stdin_handle, &process_stdin); | |
| 170 Socket::GetSocketIdNativeField(stdout_handle, &process_stdout); | |
| 171 Socket::GetSocketIdNativeField(stderr_handle, &process_stderr); | |
| 172 Socket::GetSocketIdNativeField(exit_handle, &exit_event); | |
| 173 ProcessResult result; | 169 ProcessResult result; |
| 174 intptr_t pid; | 170 intptr_t pid; |
| 175 Process::GetProcessIdNativeField(process, &pid); | 171 Process::GetProcessIdNativeField(process, &pid); |
| 176 if (Process::Wait(pid, | 172 if (Process::Wait(pid, |
| 177 process_stdin, | 173 process_stdin, |
| 178 process_stdout, | 174 process_stdout, |
| 179 process_stderr, | 175 process_stderr, |
| 180 exit_event, | 176 exit_event, |
| 181 &result)) { | 177 &result)) { |
| 182 Dart_Handle out = result.stdout_data(); | 178 Dart_Handle out = result.stdout_data(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 int external_length = strlen(system_string); | 281 int external_length = strlen(system_string); |
| 286 uint8_t* buffer = NULL; | 282 uint8_t* buffer = NULL; |
| 287 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); | 283 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); |
| 288 memmove(buffer, system_string, external_length); | 284 memmove(buffer, system_string, external_length); |
| 289 if (utf8 != system_string) free(const_cast<char*>(system_string)); | 285 if (utf8 != system_string) free(const_cast<char*>(system_string)); |
| 290 Dart_SetReturnValue(args, external_array); | 286 Dart_SetReturnValue(args, external_array); |
| 291 } | 287 } |
| 292 | 288 |
| 293 } // namespace bin | 289 } // namespace bin |
| 294 } // namespace dart | 290 } // namespace dart |
| OLD | NEW |