Unverified Commit 113f8f1a authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

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.
parent 08e7f265
...@@ -25,6 +25,7 @@ void main() { ...@@ -25,6 +25,7 @@ void main() {
}); });
tearDown(() async { tearDown(() async {
await _flutter.stop();
tryToDelete(tempDir); tryToDelete(tempDir);
}); });
...@@ -52,11 +53,7 @@ void main() { ...@@ -52,11 +53,7 @@ void main() {
test('writes pid-file', () async { test('writes pid-file', () async {
final File pidFile = tempDir.childFile('test.pid'); final File pidFile = tempDir.childFile('test.pid');
await _flutter.run(pidFile: pidFile); await _flutter.run(pidFile: pidFile);
try { expect(pidFile.existsSync(), isTrue);
expect(pidFile.existsSync(), isTrue);
} finally {
await _flutter.stop();
}
}); });
}, timeout: const Timeout.factor(6)); }, timeout: const Timeout.factor(6));
} }
...@@ -220,8 +220,11 @@ class FlutterTestDriver { ...@@ -220,8 +220,11 @@ class FlutterTestDriver {
); );
_currentRunningAppId = null; _currentRunningAppId = null;
} }
_debugPrint('Waiting for process to end'); if (_proc != null) {
return _proc.exitCode.timeout(quitTimeout, onTimeout: _killGracefully); _debugPrint('Waiting for process to end');
return _proc.exitCode.timeout(quitTimeout, onTimeout: _killGracefully);
}
return 0;
} }
Future<int> quit() => _killGracefully(); Future<int> quit() => _killGracefully();
......
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