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

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: Rebased 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..42a4056e665fa48fbd531fead9c4cdbe955e9dc3 100644
--- a/sdk/lib/_internal/compiler/implementation/dart2js.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart2js.dart
@@ -4,7 +4,8 @@
library dart2js.cmdline;
-import 'dart:async';
+import 'dart:async'
+ show Future, EventSink;
import 'dart:io'
show exit, File, FileMode, Platform, RandomAccessFile;
import 'dart:math' as math;
@@ -418,9 +419,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 +459,7 @@ void fail(String message) {
} else {
print(message);
}
- exit(1);
+ exitFunc(1);
}
Future compilerMain(List<String> arguments) {
@@ -592,7 +593,7 @@ void helpAndExit(bool wantHelp, bool wantVersion, bool verbose) {
help();
}
}
- exit(0);
+ exitFunc(0);
}
void helpAndFail(String message) {
@@ -602,11 +603,18 @@ 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');
+ print('The compiler crashed: $exception');
} catch (ignored) {
- print('Internal error: error while printing exception');
+ print('The compiler crashed: error while printing exception');
}
try {
@@ -614,7 +622,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();
+ }
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/compiler.dart ('k') | sdk/lib/_internal/compiler/implementation/util/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698