Skip to content

Fix TypeError in git.execute(..., output_stream=file) #782

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

Merged
merged 2 commits into from
Aug 5, 2018

Conversation

the-owl
Copy link

@the-owl the-owl commented Jul 24, 2018

This fixes issue #619 - raise GitCommandError(not TypeError) when output_stream is set
in git.execute(...).

Dmitry Nikulin added 2 commits July 24, 2018 23:43
@@ -794,7 +794,7 @@ def _kill_process(pid):
else:
max_chunk_size = max_chunk_size if max_chunk_size and max_chunk_size > 0 else io.DEFAULT_BUFFER_SIZE
stream_copy(proc.stdout, output_stream, max_chunk_size)
stdout_value = output_stream
stdout_value = proc.stdout.read()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's probably the only way to do this properly, even though it seems funky. Ideally stdout_value should be the value read, but in this case, it will always be an empty string as read() is called right after stream_copy(...).
However, looking at it, the whole implementations seems to have gotten somewhat convoluted over the years, so it's probably alright after all.

@Byron Byron merged commit b3d9b8d into gitpython-developers:master Aug 5, 2018
@Byron
Copy link
Member

Byron commented Aug 5, 2018

Thanks a lot! This fix is much appreciated.

@Byron Byron added this to the v2.1.12 - Bugfixes milestone Aug 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants