Attach standard streams of the child sky_shell process so that logs from the shell show up. (#4024)

This commit is contained in:
Chinmay Garde 2016-05-18 16:58:46 -07:00
parent 07719ad5ba
commit 376cb2eb38

View File

@ -54,6 +54,18 @@ Future<Process> _startProcess(String mainPath, { String packages }) {
], environment: <String, String>{ 'FLUTTER_TEST': 'true' });
}
void _attachStandardStreams(Process process) {
for (Stream<List<int>> stream in
<Stream<List<int>>>[process.stderr, process.stdout]) {
stream.transform(UTF8.decoder)
.transform(const LineSplitter())
.listen((String line) {
if (line != null)
print('Shell: $line');
});
}
}
class FlutterPlatform extends PlatformPlugin {
@override
StreamChannel<String> loadChannel(String mainPath, TestPlatform platform) {
@ -93,6 +105,8 @@ void main() {
listenerFile.path, packages: PackageMap.instance.packagesPath
);
_attachStandardStreams(process);
void finalize() {
if (process != null) {
Process processToKill = process;