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/log.h" |
7 #include "bin/platform.h" | 8 #include "bin/platform.h" |
8 #include "bin/process.h" | 9 #include "bin/process.h" |
9 #include "bin/socket.h" | 10 #include "bin/socket.h" |
10 #include "bin/utils.h" | 11 #include "bin/utils.h" |
11 | 12 |
12 #include "include/dart_api.h" | 13 #include "include/dart_api.h" |
13 | 14 |
14 namespace dart { | 15 namespace dart { |
15 namespace bin { | 16 namespace bin { |
16 | 17 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); | 210 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); |
210 bool success = Process::Kill(pid, signal); | 211 bool success = Process::Kill(pid, signal); |
211 Dart_SetReturnValue(args, Dart_NewBoolean(success)); | 212 Dart_SetReturnValue(args, Dart_NewBoolean(success)); |
212 } | 213 } |
213 | 214 |
214 | 215 |
215 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { | 216 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { |
216 int64_t status = 0; | 217 int64_t status = 0; |
217 // Ignore result if passing invalid argument and just exit 0. | 218 // Ignore result if passing invalid argument and just exit 0. |
218 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); | 219 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
219 Dart_ExitIsolate(); | 220 Dart_ShutdownIsolate(); |
220 Dart_Cleanup(); | 221 Process::TerminateExitCodeHandler(); |
| 222 char* error = Dart_Cleanup(); |
| 223 if (error != NULL) { |
| 224 Log::PrintErr("VM cleanup failed: %s\n", error); |
| 225 free(error); |
| 226 } |
221 exit(static_cast<int>(status)); | 227 exit(static_cast<int>(status)); |
222 } | 228 } |
223 | 229 |
224 | 230 |
225 void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { | 231 void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { |
226 int64_t status = 0; | 232 int64_t status = 0; |
227 // Ignore result if passing invalid argument and just set exit code to 0. | 233 // Ignore result if passing invalid argument and just set exit code to 0. |
228 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); | 234 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
229 Process::SetGlobalExitCode(status); | 235 Process::SetGlobalExitCode(status); |
230 } | 236 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 free(const_cast<char*>(system_string)); | 342 free(const_cast<char*>(system_string)); |
337 Dart_PropagateError(result); | 343 Dart_PropagateError(result); |
338 } | 344 } |
339 memmove(buffer, system_string, system_len); | 345 memmove(buffer, system_string, system_len); |
340 free(const_cast<char*>(system_string)); | 346 free(const_cast<char*>(system_string)); |
341 Dart_SetReturnValue(args, external_array); | 347 Dart_SetReturnValue(args, external_array); |
342 } | 348 } |
343 | 349 |
344 } // namespace bin | 350 } // namespace bin |
345 } // namespace dart | 351 } // namespace dart |
OLD | NEW |