Index: lib/src/util/io.dart |
diff --git a/lib/src/util/io.dart b/lib/src/util/io.dart |
index 39c336ac84ddff329fcecdc6fee2f9932b7110f5..047e7557c1369a7a58fd5344c3be66091ff49aca 100644 |
--- a/lib/src/util/io.dart |
+++ b/lib/src/util/io.dart |
@@ -9,6 +9,7 @@ import 'dart:io'; |
import 'dart:mirrors'; |
import 'package:path/path.dart' as p; |
+import 'package:pub_semver/pub_semver.dart'; |
import '../backend/operating_system.dart'; |
import '../runner/load_exception.dart'; |
@@ -17,6 +18,11 @@ import '../runner/load_exception.dart'; |
final String sdkDir = |
p.dirname(p.dirname(Platform.executable)); |
+/// The version of the Dart SDK currently in use. |
kevmoo
2015/04/03 22:55:53
Annoying nit: if this check fails, an exception wi
|
+final Version _sdkVersion = new Version.parse( |
+ new File(p.join(p.dirname(p.dirname(Platform.executable)), 'version')) |
+ .readAsStringSync().trim()); |
+ |
/// Returns the current operating system. |
final OperatingSystem currentOS = (() { |
var name = Platform.operatingSystem; |
@@ -38,8 +44,16 @@ bool get _supportsIsolateKill { |
// This isn't 100% accurate, since early 1.9 dev releases didn't support |
// Isolate.kill(), but it's very unlikely anyone will be using them. |
// TODO(nweiz): remove this when we no longer support older Dart versions. |
- var path = p.join(p.dirname(p.dirname(Platform.executable)), 'version'); |
- return !new File(path).readAsStringSync().startsWith('1.8'); |
+ return new VersionConstraint.parse('>=1.9.0-dev <2.0.0').allows(_sdkVersion); |
+} |
+ |
+/// Returns whether the current Dart version has a fix for issue 23084. |
+final bool supportsPubServe = _supportsPubServe; |
+bool get _supportsPubServe { |
+ // This isn't 100% accurate, since issue 23084 wasn't fixed in early 1.10 dev |
+ // releases, but it's unlikely anyone will be using them. |
+ // TODO(nweiz): remove this when we no longer support older Dart versions. |
+ return new VersionConstraint.parse('>=1.9.2 <2.0.0').allows(_sdkVersion); |
} |
// TODO(nweiz): Make this check [stdioType] once that works within "pub run". |