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