Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions appium/webdriver/appium_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,23 @@ def start(self, **kwargs: Any) -> sp.Popen:
raise AppiumServiceError(error_msg)
return self._process

def stop(self) -> bool:
def stop(self, timeout: int = 5) -> bool:
"""Stops Appium service if it is running.

The call will be ignored if the service is not running
or has been already stopped.

Args:
timeout: timeout for process termination.

Returns:
`True` if the service was running before being stopped
"""
is_terminated = False
if self.is_running:
assert self._process
self._process.terminate()
self._process.communicate(timeout=5)
self._process.communicate(timeout=timeout)
is_terminated = True
self._process = None
self._cmd = None
Expand Down
Loading