Return the expected exit code if sky_shell sees a compilation error during script loading (flutter/engine#3389)

This commit is contained in:
Jason Simmons
2017-02-03 12:14:35 -08:00
committed by GitHub
parent 45df428f8e
commit 8259f0a8bb
2 changed files with 14 additions and 4 deletions

View File

@@ -129,8 +129,9 @@ tonic::DartErrorHandleType DartController::RunFromSource(
Dart_Handle result = loader.LoadScript(main);
LogIfError(result);
tonic::DartErrorHandleType error = tonic::GetErrorHandleType(result);
if (SendStartMessage(Dart_RootLibrary()))
exit(1);
if (SendStartMessage(Dart_RootLibrary())) {
return tonic::kCompilationErrorType;
}
return error;
}

View File

@@ -40,9 +40,18 @@ class ScriptCompletionTaskObserver : public base::MessageLoop::TaskObserver {
void DidProcessTask(const base::PendingTask& pending_task) override {
shell::TestRunner& test_runner = shell::TestRunner::Shared();
bool live = test_runner.platform_view().engine().UIIsolateHasLivePorts();
shell::Engine& engine = test_runner.platform_view().engine();
if (engine.GetLoadScriptError() != tonic::kNoError) {
last_error_ = engine.GetLoadScriptError();
main_message_loop_.PostTask(FROM_HERE,
main_message_loop_.QuitWhenIdleClosure());
return;
}
bool live = engine.UIIsolateHasLivePorts();
if (prev_live_ && !live) {
last_error_ = test_runner.platform_view().engine().GetUIIsolateLastError();
last_error_ = engine.GetUIIsolateLastError();
main_message_loop_.PostTask(FROM_HERE,
main_message_loop_.QuitWhenIdleClosure());
}