Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Question: How to just print stdout and stderr when executing commands #1239

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
markusdd opened this issue May 13, 2021 · 0 comments
Closed

Comments

@markusdd
Copy link

Hi,

I am using gitpython for a small helper tool to manage somewhat complicated submodule setups.

I want it to work alongside standard git, not agaionst or around it.

Hence I want users to see the output of the commands. as they know it from plain vanilla git

e.g. a "Everything up to date" after a push without changes.

From the docs I was not really able to figure out a consistent way to do it.

For commit, I was able to achieve it like this: print(toprepo.git.commit(a=pa.add, m=msg, with_stdout=True))

For push, the same does not work, because it ends up on stderr print(toprepo.git.push(pa.remote, with_stdout=True)):
Logger produces this:
INFO:git.cmd:git push origin -> 0; stdout: '<OUTPUT_STREAM>'; stderr: 'Everything up-to-date'

When using the built in remote.push() and remote.pull() methosds I cannot find a way to retrieve the output at all, as with_stdout=False is hardcoded without a way to override it via kwargs.

Can you give guidance on how to cover my use-case?

@Byron Byron closed this as completed May 14, 2021
@gitpython-developers gitpython-developers locked and limited conversation to collaborators May 14, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Development

No branches or pull requests

2 participants