Skip to content

Commit 513ac0f

Browse files
johnniwinthercommit-bot@chromium.org
authored andcommitted
Implement runDiff for Windows
Change-Id: Ic9191e3844e5bcd47c97867f4a7cec52c161fd7a Reviewed-on: https://dart-review.googlesource.com/35280 Commit-Queue: Johnni Winther <[email protected]> Reviewed-by: Peter von der Ahé <[email protected]>
1 parent 1d1cc3c commit 513ac0f

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

pkg/front_end/lib/src/fasta/testing/kernel_chain.dart

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ library fasta.testing.kernel_chain;
99

1010
import 'dart:async' show Future;
1111

12-
import 'dart:io' show Directory, File, IOSink, Platform;
12+
import 'dart:io' show Directory, File, IOSink;
1313

1414
import 'dart:typed_data' show Uint8List;
1515

@@ -275,19 +275,9 @@ class BytesCollector implements Sink<List<int>> {
275275
}
276276

277277
Future<String> runDiff(Uri expected, String actual) async {
278-
if (Platform.isWindows) {
279-
// TODO(ahe): Implement this for Windows.
280-
return """
281-
==> Expected ($expected) <==
282-
${new File.fromUri(expected).readAsStringSync()}
283-
284-
==> Actual <==
285-
$actual
286-
287-
""";
288-
}
289-
StdioProcess process = await StdioProcess
290-
.run("diff", <String>["-u", expected.toFilePath(), "-"], input: actual);
278+
StdioProcess process = await StdioProcess.run(
279+
"git", <String>["diff", "--no-index", "-u", expected.toFilePath(), "-"],
280+
input: actual, runInShell: true);
291281
return process.output;
292282
}
293283

pkg/testing/lib/src/stdio_process.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ class StdioProcess {
4343
static Future<StdioProcess> run(String executable, List<String> arguments,
4444
{String input,
4545
Duration timeout: const Duration(seconds: 60),
46-
bool suppressOutput: true}) async {
47-
Process process = await Process.start(executable, arguments);
46+
bool suppressOutput: true,
47+
bool runInShell: false}) async {
48+
Process process =
49+
await Process.start(executable, arguments, runInShell: runInShell);
4850
Timer timer;
4951
StringBuffer sb = new StringBuffer();
5052
if (timeout != null) {

0 commit comments

Comments
 (0)