Skip to content

Commit 4faf5cd

Browse files
OswinNathanialdpursehouse
authored andcommitted
Rename execute param 'timeout' to 'kill_after_timeout'
Change-Id: I8ab3d5affb3f040dd9630687fb20aedbd7510070
1 parent 7cc0e6c commit 4faf5cd

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

git/cmd.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output',
4444
'with_exceptions', 'as_process', 'stdout_as_string',
45-
'output_stream', 'with_stdout', 'timeout')
45+
'output_stream', 'with_stdout', 'kill_after_timeout')
4646

4747
log = logging.getLogger('git.cmd')
4848
log.addHandler(logging.NullHandler())
@@ -476,7 +476,7 @@ def execute(self, command,
476476
as_process=False,
477477
output_stream=None,
478478
stdout_as_string=True,
479-
timeout=None,
479+
kill_after_timeout=None,
480480
with_stdout=True,
481481
**subprocess_kwargs
482482
):
@@ -533,7 +533,7 @@ def execute(self, command,
533533
534534
:param with_stdout: If True, default True, we open stdout on the created process
535535
536-
:param timeout:
536+
:param kill_after_timeout:
537537
To specify a timeout in seconds for the git command, after which the process
538538
should be killed. This will have no effect if as_process is set to True. It is
539539
set to None by default and will let the process run until the timeout is
@@ -576,8 +576,8 @@ def execute(self, command,
576576

577577
if sys.platform == 'win32':
578578
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.')
581581
else:
582582
if sys.version_info[0] > 2:
583583
cmd_not_found_exception = FileNotFoundError # NOQA # this is defined, but flake8 doesn't know
@@ -623,24 +623,24 @@ def _kill_process(pid):
623623
return
624624
# end
625625

626-
if timeout:
626+
if kill_after_timeout:
627627
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, ))
629629

630630
# Wait for the process to return
631631
status = 0
632632
stdout_value = b''
633633
stderr_value = b''
634634
try:
635635
if output_stream is None:
636-
if timeout:
636+
if kill_after_timeout:
637637
watchdog.start()
638638
stdout_value, stderr_value = proc.communicate()
639-
if timeout:
639+
if kill_after_timeout:
640640
watchdog.cancel()
641641
if kill_check.isSet():
642642
stderr_value = 'Timeout: the command "%s" did not complete in %d ' \
643-
'secs.' % (" ".join(command), timeout)
643+
'secs.' % (" ".join(command), kill_after_timeout)
644644
# strip trailing "\n"
645645
if stdout_value.endswith(b"\n"):
646646
stdout_value = stdout_value[:-1]

0 commit comments

Comments
 (0)