Unverified Commit e8c5d66b authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

Use processManager.run() instead of manually capturing streams in test_utils getPackages() (#41687)

* Capture stdout in test helper

* Simplify running getPackages() in test utils

* Remove unused import
parent f57774fe
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
......@@ -47,11 +46,8 @@ Future<void> getPackages(String folder) async {
'pub',
'get',
];
final Process process = await processManager.start(command, workingDirectory: folder);
final StringBuffer errorOutput = StringBuffer();
process.stderr.transform(utf8.decoder).listen(errorOutput.write);
final int exitCode = await process.exitCode;
if (exitCode != 0) {
throw Exception('flutter pub get failed: $errorOutput');
final ProcessResult result = await processManager.run(command, workingDirectory: folder);
if (result.exitCode != 0) {
throw Exception('flutter pub get failed: ${result.stderr}\n${result.stdout}');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment