| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // TODO(nweiz): This is under lib so that it can be used by the unittest dummy | 5 // TODO(nweiz): This is under lib so that it can be used by the unittest dummy |
| 6 // package. Once that package is no longer being updated, move this back into | 6 // package. Once that package is no longer being updated, move this back into |
| 7 // bin. | 7 // bin. |
| 8 library test.executable; | 8 library test.executable; |
| 9 | 9 |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 /// This defaults to half the available processors, since presumably some of | 33 /// This defaults to half the available processors, since presumably some of |
| 34 /// them will be used for the OS and other processes. | 34 /// them will be used for the OS and other processes. |
| 35 final _defaultConcurrency = math.max(1, Platform.numberOfProcessors ~/ 2); | 35 final _defaultConcurrency = math.max(1, Platform.numberOfProcessors ~/ 2); |
| 36 | 36 |
| 37 /// A merged stream of all signals that tell the test runner to shut down | 37 /// A merged stream of all signals that tell the test runner to shut down |
| 38 /// gracefully. | 38 /// gracefully. |
| 39 /// | 39 /// |
| 40 /// Signals will only be captured as long as this has an active subscription. | 40 /// Signals will only be captured as long as this has an active subscription. |
| 41 /// Otherwise, they'll be handled by Dart's default signal handler, which | 41 /// Otherwise, they'll be handled by Dart's default signal handler, which |
| 42 /// terminates the program immediately. | 42 /// terminates the program immediately. |
| 43 final _signals = mergeStreams([ | 43 final _signals = Platform.isWindows |
| 44 ProcessSignal.SIGTERM.watch(), ProcessSignal.SIGINT.watch() | 44 ? ProcessSignal.SIGINT.watch() |
| 45 ]); | 45 : mergeStreams([ |
| 46 ProcessSignal.SIGTERM.watch(), |
| 47 ProcessSignal.SIGINT.watch() |
| 48 ]); |
| 46 | 49 |
| 47 /// Returns whether the current package has a pubspec which uses the | 50 /// Returns whether the current package has a pubspec which uses the |
| 48 /// `test/pub_serve` transformer. | 51 /// `test/pub_serve` transformer. |
| 49 bool get _usesTransformer { | 52 bool get _usesTransformer { |
| 50 if (!new File('pubspec.yaml').existsSync()) return false; | 53 if (!new File('pubspec.yaml').existsSync()) return false; |
| 51 var contents = new File('pubspec.yaml').readAsStringSync(); | 54 var contents = new File('pubspec.yaml').readAsStringSync(); |
| 52 | 55 |
| 53 var yaml; | 56 var yaml; |
| 54 try { | 57 try { |
| 55 yaml = loadYaml(contents); | 58 yaml = loadYaml(contents); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 if (description is! Map) return false; | 359 if (description is! Map) return false; |
| 357 var path = description["path"]; | 360 var path = description["path"]; |
| 358 if (path is! String) return false; | 361 if (path is! String) return false; |
| 359 | 362 |
| 360 print("$version (from $path)"); | 363 print("$version (from $path)"); |
| 361 return true; | 364 return true; |
| 362 | 365 |
| 363 default: return false; | 366 default: return false; |
| 364 } | 367 } |
| 365 } | 368 } |
| OLD | NEW |