Make FlutterTestDriver.stop() safe to call if it didn't spawn a process (#24393)
This means we can just always add it to test teardowns without having to add try/catches if there are any tests that don't spawn a process.
This commit is contained in:
@@ -25,6 +25,7 @@ void main() {
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
await _flutter.stop();
|
||||
tryToDelete(tempDir);
|
||||
});
|
||||
|
||||
@@ -52,11 +53,7 @@ void main() {
|
||||
test('writes pid-file', () async {
|
||||
final File pidFile = tempDir.childFile('test.pid');
|
||||
await _flutter.run(pidFile: pidFile);
|
||||
try {
|
||||
expect(pidFile.existsSync(), isTrue);
|
||||
} finally {
|
||||
await _flutter.stop();
|
||||
}
|
||||
expect(pidFile.existsSync(), isTrue);
|
||||
});
|
||||
}, timeout: const Timeout.factor(6));
|
||||
}
|
||||
|
||||
@@ -220,8 +220,11 @@ class FlutterTestDriver {
|
||||
);
|
||||
_currentRunningAppId = null;
|
||||
}
|
||||
_debugPrint('Waiting for process to end');
|
||||
return _proc.exitCode.timeout(quitTimeout, onTimeout: _killGracefully);
|
||||
if (_proc != null) {
|
||||
_debugPrint('Waiting for process to end');
|
||||
return _proc.exitCode.timeout(quitTimeout, onTimeout: _killGracefully);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Future<int> quit() => _killGracefully();
|
||||
|
||||
Reference in New Issue
Block a user