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() {
});
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();
......
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