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

Side by Side Diff: pkg/unittest/lib/vm_config.dart

Issue 14580013: Close stdout and stderr before terminating the VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: l Created 7 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * A simple unit test library for running tests on the VM. 6 * A simple unit test library for running tests on the VM.
7 */ 7 */
8 library unittest_vm_config; 8 library unittest_vm_config;
9 9
10 import 'dart:async';
10 import 'dart:io'; 11 import 'dart:io';
11 import 'unittest.dart'; 12 import 'unittest.dart';
12 13
13 class VMConfiguration extends Configuration { 14 class VMConfiguration extends Configuration {
14 // Color constants used for generating messages. 15 // Color constants used for generating messages.
15 final String GREEN_COLOR = '\u001b[32m'; 16 final String GREEN_COLOR = '\u001b[32m';
16 final String RED_COLOR = '\u001b[31m'; 17 final String RED_COLOR = '\u001b[31m';
17 final String MAGENTA_COLOR = '\u001b[35m'; 18 final String MAGENTA_COLOR = '\u001b[35m';
18 final String NO_COLOR = '\u001b[0m'; 19 final String NO_COLOR = '\u001b[0m';
19 20
(...skipping 11 matching lines...) Expand all
31 } else if (testCase.result == FAIL) { 32 } else if (testCase.result == FAIL) {
32 return "${RED_COLOR}${result}${NO_COLOR}"; 33 return "${RED_COLOR}${result}${NO_COLOR}";
33 } else if (testCase.result == ERROR) { 34 } else if (testCase.result == ERROR) {
34 return "${MAGENTA_COLOR}${result}${NO_COLOR}"; 35 return "${MAGENTA_COLOR}${result}${NO_COLOR}";
35 } 36 }
36 } 37 }
37 return result; 38 return result;
38 } 39 }
39 40
40 void onDone(bool success) { 41 void onDone(bool success) {
42 int status;
41 try { 43 try {
42 super.onDone(success); 44 super.onDone(success);
43 exit(0); 45 status = 0;
44 } catch (ex) { 46 } catch (ex) {
45 // A non-zero exit code is used by the test infrastructure to detect 47 // A non-zero exit code is used by the test infrastructure to detect
46 // failure. 48 // failure.
47 exit(1); 49 status = 1;
48 } 50 }
51 Future.wait([stdout.close(), stderr.close()]).then((_) {
52 exit(status);
53 });
49 } 54 }
50 } 55 }
51 56
52 void useVMConfiguration() { 57 void useVMConfiguration() {
53 unittestConfiguration = _singleton; 58 unittestConfiguration = _singleton;
54 } 59 }
55 60
56 final _singleton = new VMConfiguration(); 61 final _singleton = new VMConfiguration();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698