Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Unified Diff: sdk/lib/_internal/compiler/implementation/dart2js.dart

Issue 80793002: Check compiler exitCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/dart2js.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart2js.dart b/sdk/lib/_internal/compiler/implementation/dart2js.dart
index 7869913ae7b2ade37f4be09a24e6dfb852bf0bef..84e53131092dfe165d3c99944e1ca3e1662294f6 100644
--- a/sdk/lib/_internal/compiler/implementation/dart2js.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart2js.dart
@@ -418,9 +418,9 @@ Future compile(List<String> argv) {
return new EventSinkWrapper(writeStringSync, onDone);
}
- return api.compile(uri, libraryRoot, packageRoot,
- inputProvider, diagnosticHandler,
- options, outputProvider, environment)
+ return compileFunc(uri, libraryRoot, packageRoot,
+ inputProvider, diagnosticHandler,
+ options, outputProvider, environment)
.then(compilationDone);
}
@@ -458,7 +458,7 @@ void fail(String message) {
} else {
print(message);
}
- exit(1);
+ exitFunc(1);
}
Future compilerMain(List<String> arguments) {
@@ -592,7 +592,7 @@ void helpAndExit(bool wantHelp, bool wantVersion, bool verbose) {
help();
}
}
- exit(0);
+ exitFunc(0);
}
void helpAndFail(String message) {
@@ -602,7 +602,14 @@ void helpAndFail(String message) {
}
void main(List<String> arguments) {
- runZoned(() => compilerMain(arguments), onError: (exception, trace) {
+ internalMain(arguments);
+}
+
+var exitFunc = exit;
+var compileFunc = api.compile;
+
+Future internalMain(List<String> arguments) {
+ onError(exception, trace) {
try {
print('Internal error: $exception');
} catch (ignored) {
@@ -614,7 +621,14 @@ void main(List<String> arguments) {
print(trace);
}
} finally {
- exit(253); // 253 is recognized as a crash by our test scripts.
+ exitFunc(253); // 253 is recognized as a crash by our test scripts.
}
- });
+ }
+
+ try {
+ return compilerMain(arguments).catchError(onError);
+ } catch (exception, trace) {
+ onError(exception, trace);
+ return new Future.value();
+ }
}

Powered by Google App Engine
This is Rietveld 408576698