Skip to content
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

universal_newlines is not respected if git process times out #1116

Closed
x-santiaga-x opened this issue Jan 27, 2021 · 3 comments
Closed

universal_newlines is not respected if git process times out #1116

x-santiaga-x opened this issue Jan 27, 2021 · 3 comments

Comments

@x-santiaga-x
Copy link
Contributor

In Git.execute if kill_check.isSet(): then stderr_value will be encoded to bytes even if universal_newlines is set.

@Byron
Copy link
Member

Byron commented Jan 28, 2021

Can you be more specific as to allow a PR to be created? In that moment I request a change of the subject as well.
This issue isn't currently actionable.

This issue will be reopened once the requested information was provided.

@Byron Byron closed this as completed Jan 28, 2021
@x-santiaga-x
Copy link
Contributor Author

If we run operation long enough to be killed after timeout and use universal_newlines set to True as this

from git.cmd import Git
g = Git(r'/path/to/repo')
g.rev_list('HEAD', kill_after_timeout=1e-6, universal_newlines=True)

script execution stopped with traceback

Traceback (most recent call last):
  File "../src/test.py", line 28, in <module>
    g.rev_list('HEAD', kill_after_timeout=1e-6, universal_newlines=True)
  File "/venv/path/lib64/python3.6/site-packages/git/cmd.py", line 542, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/venv/path/lib64/python3.6/site-packages/git/cmd.py", line 1006, in _call_process
    return self.execute(call, **exec_kwargs)
  File "/venv/path/lib64/python3.6/site-packages/git/cmd.py", line 789, in execute
    if stderr_value.endswith(newline):
TypeError: endswith first arg must be bytes or a tuple of bytes, not str

because stderr_value is an error message about timeout decoded to bytes, but with universal_newlines = True newline is str, not bytes.

@Byron Byron reopened this Jan 28, 2021
@Byron Byron changed the title Yet another universal_newlines TypeError universal_newlines is not respected if git process times out Jan 28, 2021
@Byron
Copy link
Member

Byron commented Jan 28, 2021

Thanks a lot! This looks like the logic here needs to adhere to the universal newlines flag. Would you be able to submit a PR for a fix?

@Byron Byron closed this as completed in 3c19a6e Jan 28, 2021
@Byron Byron added this to the v3.1.13 - Bugfixes milestone Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants