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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
6 | 6 |
7 #include "bin/process.h" | 7 #include "bin/process.h" |
8 | 8 |
9 #include "bin/dartutils.h" | 9 #include "bin/dartutils.h" |
10 #include "bin/io_buffer.h" | 10 #include "bin/io_buffer.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); | 239 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); |
240 bool success = Process::Kill(pid, signal); | 240 bool success = Process::Kill(pid, signal); |
241 Dart_SetReturnValue(args, Dart_NewBoolean(success)); | 241 Dart_SetReturnValue(args, Dart_NewBoolean(success)); |
242 } | 242 } |
243 | 243 |
244 | 244 |
245 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { | 245 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { |
246 int64_t status = 0; | 246 int64_t status = 0; |
247 // Ignore result if passing invalid argument and just exit 0. | 247 // Ignore result if passing invalid argument and just exit 0. |
248 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); | 248 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
| 249 IsolateData* isolate_data = |
| 250 reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData()); |
| 251 if (isolate_data->exit_hook() != NULL) { |
| 252 isolate_data->exit_hook()(status); |
| 253 } |
249 Dart_ExitIsolate(); | 254 Dart_ExitIsolate(); |
250 Platform::Exit(static_cast<int>(status)); | 255 Platform::Exit(static_cast<int>(status)); |
251 } | 256 } |
252 | 257 |
253 | 258 |
254 void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { | 259 void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { |
255 int64_t status = 0; | 260 int64_t status = 0; |
256 // Ignore result if passing invalid argument and just set exit code to 0. | 261 // Ignore result if passing invalid argument and just set exit code to 0. |
257 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); | 262 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
258 Process::SetGlobalExitCode(status); | 263 Process::SetGlobalExitCode(status); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 if (!Dart_IsError(external_array)) { | 367 if (!Dart_IsError(external_array)) { |
363 memmove(buffer, system_string, system_len); | 368 memmove(buffer, system_string, system_len); |
364 } | 369 } |
365 Dart_SetReturnValue(args, external_array); | 370 Dart_SetReturnValue(args, external_array); |
366 } | 371 } |
367 | 372 |
368 } // namespace bin | 373 } // namespace bin |
369 } // namespace dart | 374 } // namespace dart |
370 | 375 |
371 #endif // !defined(DART_IO_DISABLED) | 376 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |