I've got a problem, when I'm trying to obtain output of following command:
git shortlog -s -- [file_path]
using python 3.6 subprocess module.
Here the code:
import subprocess
x = subprocess.Popen(['git shortlog -s -- ' + file_path], cwd=path,
shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE).communicate()[0]
print(x)
The result of execution is empty. What had I done wrong?
you need to call git shortlog HEAD
subprocess.Popen(['git shortlog HEAD -s -- ' + file_path],
cwd=path, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE).communicate()[0]
To learn why, see https://stackoverflow.com/a/43042420/4381942
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With