| 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/process.h" | 7 #include "bin/process.h" |
| 8 #include "bin/socket.h" | 8 #include "bin/socket.h" |
| 9 | 9 |
| 10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 Socket::GetSocketIdNativeField(exit_handle, &exit_event); | 176 Socket::GetSocketIdNativeField(exit_handle, &exit_event); |
| 177 ProcessResult result; | 177 ProcessResult result; |
| 178 intptr_t pid; | 178 intptr_t pid; |
| 179 Process::GetProcessIdNativeField(process, &pid); | 179 Process::GetProcessIdNativeField(process, &pid); |
| 180 if (Process::Wait(pid, | 180 if (Process::Wait(pid, |
| 181 process_stdin, | 181 process_stdin, |
| 182 process_stdout, | 182 process_stdout, |
| 183 process_stderr, | 183 process_stderr, |
| 184 exit_event, | 184 exit_event, |
| 185 &result)) { | 185 &result)) { |
| 186 Dart_Handle out = | 186 Dart_Handle out = result.stdout_data(); |
| 187 IOBuffer::Create(result.stdout_data(), result.stdout_length()); | 187 if (Dart_IsError(out)) Dart_PropagateError(out); |
| 188 Dart_Handle err = | 188 Dart_Handle err = result.stderr_data(); |
| 189 IOBuffer::Create(result.stderr_data(), result.stderr_length()); | 189 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 190 Dart_Handle list = Dart_NewList(4); | 190 Dart_Handle list = Dart_NewList(4); |
| 191 Dart_ListSetAt(list, 0, Dart_NewInteger(pid)); | 191 Dart_ListSetAt(list, 0, Dart_NewInteger(pid)); |
| 192 Dart_ListSetAt(list, 1, Dart_NewInteger(result.exit_code())); | 192 Dart_ListSetAt(list, 1, Dart_NewInteger(result.exit_code())); |
| 193 Dart_ListSetAt(list, 2, out); | 193 Dart_ListSetAt(list, 2, out); |
| 194 Dart_ListSetAt(list, 3, err); | 194 Dart_ListSetAt(list, 3, err); |
| 195 Dart_SetReturnValue(args, list); | 195 Dart_SetReturnValue(args, list); |
| 196 } else { | 196 } else { |
| 197 Process::Kill(pid, 9); | 197 Process::Kill(pid, 9); |
| 198 Dart_ThrowException(DartUtils::NewDartOSError()); | 198 Dart_ThrowException(DartUtils::NewDartOSError()); |
| 199 } | 199 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 int external_length = strlen(system_string); | 286 int external_length = strlen(system_string); |
| 287 uint8_t* buffer = NULL; | 287 uint8_t* buffer = NULL; |
| 288 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); | 288 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); |
| 289 memmove(buffer, system_string, external_length); | 289 memmove(buffer, system_string, external_length); |
| 290 if (utf8 != system_string) free(const_cast<char*>(system_string)); | 290 if (utf8 != system_string) free(const_cast<char*>(system_string)); |
| 291 Dart_SetReturnValue(args, external_array); | 291 Dart_SetReturnValue(args, external_array); |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace bin | 294 } // namespace bin |
| 295 } // namespace dart | 295 } // namespace dart |
| OLD | NEW |