| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7cc0e6c commit 4faf5cd
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,7 +42,7 @@ | |||
| 42 | 42 | ||
| 43 | 43 | execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output', | |
| 44 | 44 | 'with_exceptions', 'as_process', 'stdout_as_string', | |
| 45 | - 'output_stream', 'with_stdout', 'timeout') | ||
| 45 | + 'output_stream', 'with_stdout', 'kill_after_timeout') | ||
| 46 | 46 | ||
| 47 | 47 | log = logging.getLogger('git.cmd') | |
| 48 | 48 | log.addHandler(logging.NullHandler()) | |
@@ -476,7 +476,7 @@ def execute(self, command, | |||
| 476 | 476 | as_process=False, | |
| 477 | 477 | output_stream=None, | |
| 478 | 478 | stdout_as_string=True, | |
| 479 | - timeout=None, | ||
| 479 | + kill_after_timeout=None, | ||
| 480 | 480 | with_stdout=True, | |
| 481 | 481 | **subprocess_kwargs | |
| 482 | 482 | ): | |
@@ -533,7 +533,7 @@ def execute(self, command, | |||
| 533 | 533 | ||
| 534 | 534 | :param with_stdout: If True, default True, we open stdout on the created process | |
| 535 | 535 | ||
| 536 | - :param timeout: | ||
| 536 | + :param kill_after_timeout: | ||
| 537 | 537 | To specify a timeout in seconds for the git command, after which the process | |
| 538 | 538 | should be killed. This will have no effect if as_process is set to True. It is | |
| 539 | 539 | set to None by default and will let the process run until the timeout is | |
@@ -576,8 +576,8 @@ def execute(self, command, | |||
| 576 | 576 | ||
| 577 | 577 | if sys.platform == 'win32': | |
| 578 | 578 | cmd_not_found_exception = WindowsError | |
| 579 | - if timeout: | ||
| 580 | - raise GitCommandError('"timeout" feature is not supported on Windows.') | ||
| 579 | + if kill_after_timeout: | ||
| 580 | + raise GitCommandError('"kill_after_timeout" feature is not supported on Windows.') | ||
| 581 | 581 | else: | |
| 582 | 582 | if sys.version_info[0] > 2: | |
| 583 | 583 | cmd_not_found_exception = FileNotFoundError # NOQA # this is defined, but flake8 doesn't know | |
@@ -623,24 +623,24 @@ def _kill_process(pid): | |||
| 623 | 623 | return | |
| 624 | 624 | # end | |
| 625 | 625 | ||
| 626 | - if timeout: | ||
| 626 | + if kill_after_timeout: | ||
| 627 | 627 | kill_check = threading.Event() | |
| 628 | - watchdog = threading.Timer(timeout, _kill_process, args=(proc.pid, )) | ||
| 628 | + watchdog = threading.Timer(kill_after_timeout, _kill_process, args=(proc.pid, )) | ||
| 629 | 629 | ||
| 630 | 630 | # Wait for the process to return | |
| 631 | 631 | status = 0 | |
| 632 | 632 | stdout_value = b'' | |
| 633 | 633 | stderr_value = b'' | |
| 634 | 634 | try: | |
| 635 | 635 | if output_stream is None: | |
| 636 | - if timeout: | ||
| 636 | + if kill_after_timeout: | ||
| 637 | 637 | watchdog.start() | |
| 638 | 638 | stdout_value, stderr_value = proc.communicate() | |
| 639 | - if timeout: | ||
| 639 | + if kill_after_timeout: | ||
| 640 | 640 | watchdog.cancel() | |
| 641 | 641 | if kill_check.isSet(): | |
| 642 | 642 | stderr_value = 'Timeout: the command "%s" did not complete in %d ' \ | |
| 643 | - 'secs.' % (" ".join(command), timeout) | ||
| 643 | + 'secs.' % (" ".join(command), kill_after_timeout) | ||
| 644 | 644 | # strip trailing "\n" | |
| 645 | 645 | if stdout_value.endswith(b"\n"): | |
| 646 | 646 | stdout_value = stdout_value[:-1] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments