| 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 #include "bin/utils.h" | 10 #include "bin/utils.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 Socket::SetSocketIdNativeField(stdin_handle, process_stdin); | 144 Socket::SetSocketIdNativeField(stdin_handle, process_stdin); |
| 145 Socket::SetSocketIdNativeField(stdout_handle, process_stdout); | 145 Socket::SetSocketIdNativeField(stdout_handle, process_stdout); |
| 146 Socket::SetSocketIdNativeField(stderr_handle, process_stderr); | 146 Socket::SetSocketIdNativeField(stderr_handle, process_stderr); |
| 147 Socket::SetSocketIdNativeField(exit_handle, exit_event); | 147 Socket::SetSocketIdNativeField(exit_handle, exit_event); |
| 148 } | 148 } |
| 149 Process::SetProcessIdNativeField(process, pid); | 149 Process::SetProcessIdNativeField(process, pid); |
| 150 } else { | 150 } else { |
| 151 DartUtils::SetIntegerField( | 151 DartUtils::SetIntegerField( |
| 152 status_handle, "_errorCode", error_code); | 152 status_handle, "_errorCode", error_code); |
| 153 DartUtils::SetStringField( | 153 DartUtils::SetStringField( |
| 154 status_handle, "_errorMessage", os_error_message); | 154 status_handle, |
| 155 "_errorMessage", |
| 156 os_error_message != NULL ? os_error_message |
| 157 : "Cannot get error message"); |
| 155 } | 158 } |
| 156 delete[] string_args; | 159 delete[] string_args; |
| 157 delete[] string_environment; | 160 delete[] string_environment; |
| 158 free(os_error_message); | 161 free(os_error_message); |
| 159 Dart_SetReturnValue(args, Dart_NewBoolean(error_code == 0)); | 162 Dart_SetReturnValue(args, Dart_NewBoolean(error_code == 0)); |
| 160 } | 163 } |
| 161 | 164 |
| 162 | 165 |
| 163 void FUNCTION_NAME(Process_Wait)(Dart_NativeArguments args) { | 166 void FUNCTION_NAME(Process_Wait)(Dart_NativeArguments args) { |
| 164 Dart_Handle process = Dart_GetNativeArgument(args, 0); | 167 Dart_Handle process = Dart_GetNativeArgument(args, 0); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 int external_length = strlen(system_string); | 311 int external_length = strlen(system_string); |
| 309 uint8_t* buffer = NULL; | 312 uint8_t* buffer = NULL; |
| 310 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); | 313 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); |
| 311 memmove(buffer, system_string, external_length); | 314 memmove(buffer, system_string, external_length); |
| 312 if (utf8 != system_string) free(const_cast<char*>(system_string)); | 315 if (utf8 != system_string) free(const_cast<char*>(system_string)); |
| 313 Dart_SetReturnValue(args, external_array); | 316 Dart_SetReturnValue(args, external_array); |
| 314 } | 317 } |
| 315 | 318 |
| 316 } // namespace bin | 319 } // namespace bin |
| 317 } // namespace dart | 320 } // namespace dart |
| OLD | NEW |