Skip to content

timeouts cause a TypeError exception #661

Closed
@Frassle

Description

@Frassle

If kill_after_timeout is used and the timeout is triggered it sets stderr_value to a string with a message the the command timed out. The code immediately below tries to strip new lines off stderr_value with endswith(b"\n") which fails with TypeError: endswith first arg must be str or a tuple of str, not bytes.

Using GitPython 2.1.5 on Python 3.4.5

/usr/local/lib/python3.4/site-packages/git/cmd.py in <lambda>(*args, **kwargs)
    423         if name[0] == '_':
    424             return LazyMixin.__getattr__(self, name)
--> 425         return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
    426 
    427     def set_persistent_git_options(self, **kwargs):

/usr/local/lib/python3.4/site-packages/git/cmd.py in _call_process(self, method, *args, **kwargs)
    875         call.extend(args)
    876 
--> 877         return self.execute(call, **exec_kwargs)
    878 
    879     def _parse_object_header(self, header_line):

/usr/local/lib/python3.4/site-packages/git/cmd.py in execute(self, command, istream, with_extended_output, with_exceptions, as_process, output_stream, stdout_as_string, kill_after_timeout, with_stdout, universal_newlines, shell, **subprocess_kwargs)
    653                 if stdout_value.endswith(b"\n"):
    654                     stdout_value = stdout_value[:-1]
--> 655                 if stderr_value.endswith(b"\n"):
    656                     stderr_value = stderr_value[:-1]
    657                 status = proc.returncode

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions