Skip to content

Commit

Permalink
[Fuchsia] Disable dart:io exit() (flutter#4080)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanderso authored Sep 11, 2017
1 parent 51f1260 commit 2abd7c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions content_handler/runtime_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ void RuntimeHolder::DidCreateMainIsolate(Dart_Isolate isolate) {
void RuntimeHolder::InitDartIoInternal() {
Dart_Handle io_lib = Dart_LookupLibrary(ToDart("dart:io"));

// Set up the namespace.
Dart_Handle namespace_type =
Dart_GetType(io_lib, ToDart("_Namespace"), 0, nullptr);
DART_CHECK_VALID(namespace_type);
Expand All @@ -372,6 +373,13 @@ void RuntimeHolder::InitDartIoInternal() {
DART_CHECK_VALID(namespace_args[0]);
DART_CHECK_VALID(Dart_Invoke(
namespace_type, ToDart("_setupNamespace"), 1, namespace_args));

// Disable dart:io exit()
Dart_Handle embedder_config_type =
Dart_GetType(io_lib, ToDart("_EmbedderConfig"), 0, nullptr);
DART_CHECK_VALID(embedder_config_type);
DART_CHECK_VALID(
Dart_SetField(embedder_config_type, ToDart("_mayExit"), Dart_False()));
}

void RuntimeHolder::InitFuchsia() {
Expand Down
1 change: 1 addition & 0 deletions runtime/dart_vm_entry_points_fuchsia.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dart:fuchsia,::,_environment
dart:fuchsia,::,_outgoingServices
dart:io,_EmbedderConfig,_mayExit
dart:io,_Namespace,_setupNamespace
dart:mozart.internal,::,_context
dart:mozart.internal,::,_viewContainer
Expand Down

0 comments on commit 2abd7c8

Please sign in to comment.