Skip to content

Commit 1c08f40

Browse files
committed
fixup! fixup! Use subprocess's timeout feature instead of reinventing the wheel
1 parent 52bf831 commit 1c08f40

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

git/cmd.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def handle_process_output(
109109
stderr_handler: Union[None, Callable[[AnyStr], None], Callable[[List[AnyStr]], None]],
110110
finalizer: Union[None, Callable[[Union[Popen, "Git.AutoInterrupt"]], None]] = None,
111111
decode_streams: bool = True,
112-
kill_after_timeout: Optional[float, int] = None,
112+
kill_after_timeout: Optional[Union[float, int]] = None,
113113
) -> None:
114114
R"""Register for notifications to learn that process output is ready to read, and
115115
dispatch lines to the respective line handlers.
@@ -335,7 +335,7 @@ def __init__(
335335
self,
336336
proc: subprocess.Popen | None,
337337
args: Any,
338-
timeout: Optional[float, int] = None,
338+
timeout: Optional[Union[float, int]] = None,
339339
) -> None:
340340
self.proc = proc
341341
self.args = args
@@ -394,7 +394,7 @@ def __getattr__(self, attr: str) -> Any:
394394
return getattr(self.proc, attr)
395395

396396
# TODO: Bad choice to mimic `proc.wait()` but with different args.
397-
def wait(self, stderr: Optional[AnyStr] = b"", timeout: Optional[int, float] = None) -> int:
397+
def wait(self, stderr: Optional[Union[str, bytes]] = b"", timeout: Optional[Union[int, float]] = None) -> int:
398398
"""Wait for the process and return its status code.
399399
400400
:param stderr:
@@ -1118,7 +1118,7 @@ def execute(
11181118
as_process: bool = False,
11191119
output_stream: Union[None, BinaryIO] = None,
11201120
stdout_as_string: bool = True,
1121-
kill_after_timeout: Optional[float, int] = None,
1121+
kill_after_timeout: Optional[Union[float, int]] = None,
11221122
with_stdout: bool = True,
11231123
universal_newlines: bool = False,
11241124
shell: Union[None, bool] = None,

0 commit comments

Comments
 (0)