[flutter_tools] don't fix chrome window size, add more logs (#51346)

This commit is contained in:
Jonah Williams
2020-02-24 12:26:05 -08:00
committed by GitHub
parent 7572ec47bd
commit 3411129cc5
2 changed files with 30 additions and 11 deletions

View File

@@ -138,9 +138,8 @@ class ChromeLauncher {
'--no-default-browser-check',
'--disable-default-apps',
'--disable-translate',
'--window-size=2400,1800',
if (headless)
...<String>['--headless', '--disable-gpu', '--no-sandbox'],
...<String>['--headless', '--disable-gpu', '--no-sandbox', '--window-size=2400,1800'],
url,
];
@@ -161,17 +160,24 @@ class ChromeLauncher {
}));
}
process.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen((String line) {
globals.printTrace('[CHROME]: $line');
});
// Wait until the DevTools are listening before trying to connect.
await process.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.firstWhere((String line) => line.startsWith('DevTools listening'), orElse: () {
return 'Failed to spawn stderr';
})
.timeout(const Duration(seconds: 60), onTimeout: () {
throwToolExit('Unable to connect to Chrome DevTools.');
return null;
});
.transform(utf8.decoder)
.transform(const LineSplitter())
.map((String line) {
globals.printTrace('[CHROME]:$line');
return line;
})
.firstWhere((String line) => line.startsWith('DevTools listening'), orElse: () {
return 'Failed to spawn stderr';
});
final Uri remoteDebuggerUri = await _getRemoteDebuggerUrl(Uri.parse('http://localhost:$port'));
return _connect(Chrome._(
port,