Skip to content

timeouts cause a TypeError exception #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Frassle opened this issue Aug 21, 2017 · 1 comment
Closed

timeouts cause a TypeError exception #661

Frassle opened this issue Aug 21, 2017 · 1 comment

Comments

@Frassle
Copy link

Frassle commented Aug 21, 2017

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
@EliahKagan
Copy link
Member

This appears to have been fixed in #1098.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants