| 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 library test.test.io; | 5 library test.test.io; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 /// Runs Dart. | 47 /// Runs Dart. |
| 48 ProcessResult runDart(List<String> args, {String workingDirectory, | 48 ProcessResult runDart(List<String> args, {String workingDirectory, |
| 49 Map<String, String> environment}) { | 49 Map<String, String> environment}) { |
| 50 var allArgs = Platform.executableArguments.map((arg) { | 50 var allArgs = Platform.executableArguments.map((arg) { |
| 51 // The package root might be relative, so we need to make it absolute if | 51 // The package root might be relative, so we need to make it absolute if |
| 52 // we're going to run in a different working directory. | 52 // we're going to run in a different working directory. |
| 53 if (!arg.startsWith("--package-root=")) return arg; | 53 if (!arg.startsWith("--package-root=")) return arg; |
| 54 return "--package-root=" + | 54 return "--package-root=" + |
| 55 p.absolute(arg.substring("--package-root=".length)); | 55 p.absolute(p.fromUri(arg.substring("--package-root=".length))); |
| 56 }).toList()..addAll(args); | 56 }).toList()..addAll(args); |
| 57 | 57 |
| 58 // TODO(nweiz): Use ScheduledProcess once it's compatible. | 58 // TODO(nweiz): Use ScheduledProcess once it's compatible. |
| 59 return new _NormalizedProcessResult(Process.runSync( | 59 return new _NormalizedProcessResult(Process.runSync( |
| 60 p.absolute(Platform.executable), allArgs, | 60 p.absolute(Platform.executable), allArgs, |
| 61 workingDirectory: workingDirectory, environment: environment)); | 61 workingDirectory: workingDirectory, environment: environment)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 /// Runs Pub. | 64 /// Runs Pub. |
| 65 ProcessResult runPub(List<String> args, {String workingDirectory, | 65 ProcessResult runPub(List<String> args, {String workingDirectory, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 _NormalizedProcessResult(ProcessResult inner) | 134 _NormalizedProcessResult(ProcessResult inner) |
| 135 : _inner = inner, | 135 : _inner = inner, |
| 136 stdout = Platform.isWindows | 136 stdout = Platform.isWindows |
| 137 ? inner.stdout.replaceAll("\r\n", "\n") | 137 ? inner.stdout.replaceAll("\r\n", "\n") |
| 138 : inner.stdout, | 138 : inner.stdout, |
| 139 stderr = Platform.isWindows | 139 stderr = Platform.isWindows |
| 140 ? inner.stderr.replaceAll("\r\n", "\n") | 140 ? inner.stderr.replaceAll("\r\n", "\n") |
| 141 : inner.stderr; | 141 : inner.stderr; |
| 142 } | 142 } |
| OLD | NEW |