简体   繁体   中英

How can I capture the output of the "git fsck" command in a python script on Windows?

I tried this ...

os.chdir(repo_path)

f = open("blah.txt", "w") subprocess.call(["git", "fsck"], stdout=f, stderr=f)

...

Couldn't find any way to do it with GitPython module either.

If I change "fsck" to "status" I see output in blah.txt but I can't see anything if I use "fsck". The output I get from the terminal when running the git command directly is ...

"Checking object directories: 100% (256/256), done."

Thanks

torek had it right. Any errors or problems coming from git fsck are showing up in stderr or stdout. If there are no problems then there is no output. I was mistaking the progress indicator as a report of success but no output is what I should have been testing for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM