Skip to content

Commit 393ba87

Browse files
committed
[py]: simplify service kwarg handling in the service base class
1 parent 005b588 commit 393ba87

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

py/CHANGES

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Selenium 4.8.3
2-
* More fine grained control for `Service` subprocesses is now available via passing a `popen_kw` keyed map to any `Service` instance.
3-
* `Service` classes can now control `close_fds` and `creationflags` via `**kwargs` on any `Service` instance.
4-
* Setting `timeouts` on an `Options` instance no longer raises an exception for subsets of supported timeouts. (#11623)
2+
* Add fine grained control for arguments provided to service subprocesses by passing a `popen_kw` mapping for all services.
3+
* `Options` classes now allow `timeout` to be set partially and no longer raise an exception when all values are not provided. (#11623)
54
* No longer sending `SIGKILL` to subprocesses in instances where `SIGTERM` was successful within 60 seconds.
65

76
Selenium 4.8.2

py/selenium/webdriver/common/service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ def __init__(
6565
self.log_file = open(os.devnull, "wb") if not _HAS_NATIVE_DEVNULL and log_file == DEVNULL else log_file
6666
self.start_error_message = start_error_message or ""
6767
# Default value for every python subprocess: subprocess.Popen(..., creationflags=0)
68-
self.creation_flags = kwargs.pop("creation_flags", 0)
69-
self.close_fds = kwargs.pop("close_fds") or system() != "Windows"
70-
self.env = env or os.environ
7168
self.popen_kw = kwargs.pop("popen_kw", {})
69+
self.creation_flags = self.popen_kw.pop("creation_flags", 0)
70+
self.env = env or os.environ
7271

7372
@property
7473
def service_url(self) -> str:
@@ -199,11 +198,12 @@ def _start_process(self, path: str) -> None:
199198
"""
200199
cmd = [path]
201200
cmd.extend(self.command_line_args())
201+
close_file_descriptors = self.popen_kw.pop("close_fds") or system() != "Windows"
202202
try:
203203
self.process = subprocess.Popen(
204204
cmd,
205205
env=self.env,
206-
close_fds=self.close_fds,
206+
close_fds=close_file_descriptors,
207207
stdout=self.log_file,
208208
stderr=self.log_file,
209209
stdin=PIPE,

0 commit comments

Comments
 (0)