[flutter_tools] fix port leak in flutter_driver (#70999)

This commit is contained in:
Jonah Williams
2020-11-21 14:04:01 -08:00
committed by GitHub
parent 226532b157
commit cf6c33e58a
3 changed files with 12 additions and 16 deletions

View File

@@ -235,16 +235,9 @@ class FlutterDriverService extends DriverService {
int driverPort,
List<String> browserDimension,
}) async {
// Check if package:test is available. If not, fall back to invoking
// the test script directly. `pub run test` is strictly better because
// in the even that a socket or something similar is left open, the
// test runner will correctly shutdown the VM instead of hanging forever.
return _processUtils.stream(<String>[
_dartSdkPath,
if (packageConfig['test'] != null)
...<String>['pub', 'run', 'test', ...arguments, testFile, '-rexpanded']
else
...<String>[...arguments, testFile, '-rexpanded'],
...<String>[...arguments, testFile, '-rexpanded'],
], environment: <String, String>{
'VM_SERVICE_URL': _vmServiceUri,
...environment,

View File

@@ -153,7 +153,7 @@ void main() {
]);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>['dart', 'pub', 'run', 'test', '--enable-experiment=non-nullable', 'foo.test', '-rexpanded'],
command: <String>['dart', '--enable-experiment=non-nullable', 'foo.test', '-rexpanded'],
exitCode: 23,
environment: <String, String>{
'FOO': 'BAR',
@@ -214,7 +214,7 @@ void main() {
]);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>['dart', 'pub', 'run', 'test', 'foo.test', '-rexpanded'],
command: <String>['dart', 'foo.test', '-rexpanded'],
exitCode: 11,
environment: <String, String>{
'VM_SERVICE_URL': 'http://127.0.0.1:1234/'