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

Side by Side Diff: pkg/analyzer/bin/analyzer.dart

Issue 135593009: Fixes for exit problems. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/services/runtime/coverage/coverage_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 2
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 6
7 /** The entry point for the analyzer. */ 7 /** The entry point for the analyzer. */
8 library analyzer; 8 library analyzer;
9 9
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 typedef ErrorSeverity BatchRunnerHandler(List<String> args); 90 typedef ErrorSeverity BatchRunnerHandler(List<String> args);
91 91
92 /// Provides a framework to read command line options from stdin and feed them t o a callback. 92 /// Provides a framework to read command line options from stdin and feed them t o a callback.
93 class BatchRunner { 93 class BatchRunner {
94 /** 94 /**
95 * Run the tool in 'batch' mode, receiving command lines through stdin and ret urning pass/fail 95 * Run the tool in 'batch' mode, receiving command lines through stdin and ret urning pass/fail
96 * status through stdout. This feature is intended for use in unit testing. 96 * status through stdout. This feature is intended for use in unit testing.
97 */ 97 */
98 static ErrorSeverity runAsBatch(List<String> sharedArgs, BatchRunnerHandler ha ndler) { 98 static void runAsBatch(List<String> sharedArgs, BatchRunnerHandler handler) {
99 stdout.writeln('>>> BATCH START'); 99 stdout.writeln('>>> BATCH START');
100 Stopwatch stopwatch = new Stopwatch(); 100 Stopwatch stopwatch = new Stopwatch();
101 stopwatch.start(); 101 stopwatch.start();
102 int testsFailed = 0; 102 int testsFailed = 0;
103 int totalTests = 0; 103 int totalTests = 0;
104 ErrorSeverity batchResult = ErrorSeverity.NONE; 104 ErrorSeverity batchResult = ErrorSeverity.NONE;
105 // read line from stdin 105 // read line from stdin
106 Stream cmdLine = stdin 106 Stream cmdLine = stdin
107 .transform(UTF8.decoder) 107 .transform(UTF8.decoder)
108 .transform(new LineSplitter()); 108 .transform(new LineSplitter());
109 var subscription = cmdLine.listen((String line) { 109 var subscription = cmdLine.listen((String line) {
110 // may be finish 110 // may be finish
111 if (line.isEmpty) { 111 if (line.isEmpty) {
112 var time = stopwatch.elapsedMilliseconds; 112 var time = stopwatch.elapsedMilliseconds;
113 stdout.writeln('>>> BATCH END (${totalTests - testsFailed}/$totalTests) ${time}ms'); 113 stdout.writeln('>>> BATCH END (${totalTests - testsFailed}/$totalTests) ${time}ms');
114 exit(batchResult.ordinal); 114 exitCode = batchResult.ordinal;
115 } 115 }
116 // prepare aruments 116 // prepare aruments
117 var args; 117 var args;
118 { 118 {
119 var lineArgs = line.split(new RegExp('\\s+')); 119 var lineArgs = line.split(new RegExp('\\s+'));
120 args = new List<String>(); 120 args = new List<String>();
121 args.addAll(sharedArgs); 121 args.addAll(sharedArgs);
122 args.addAll(lineArgs); 122 args.addAll(lineArgs);
123 args.remove('-b'); 123 args.remove('-b');
124 args.remove('--batch'); 124 args.remove('--batch');
(...skipping 15 matching lines...) Expand all
140 stdout.writeln('>>> TEST $resultPassString ${stopwatch.elapsedMillisecon ds}ms'); 140 stdout.writeln('>>> TEST $resultPassString ${stopwatch.elapsedMillisecon ds}ms');
141 } catch (e, stackTrace) { 141 } catch (e, stackTrace) {
142 stderr.writeln(e); 142 stderr.writeln(e);
143 stderr.writeln(stackTrace); 143 stderr.writeln(stackTrace);
144 stderr.writeln('>>> EOF STDERR'); 144 stderr.writeln('>>> EOF STDERR');
145 stdout.writeln('>>> TEST CRASH'); 145 stdout.writeln('>>> TEST CRASH');
146 } 146 }
147 }); 147 });
148 } 148 }
149 } 149 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/services/runtime/coverage/coverage_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698