I’m running Gitolite over the Git repository and I have post-receive hook there. The script of this hook written in Python and fails after
proc = subprocess.Popen('git log', shell = True, stdout=subprocess.PIPE)
out = proc.stdout.read()
It doesn’t execute after these lines. If I run this script manually, it works perfect.
What I’m doing wrong?
From subprocess documentation:
I’d avoid using
shell=Trueif possible too (IMO it’s only useful if you wanna use shell built-ins and it’s platform/shell specific), and pass Popen command as a list, like['git', 'log']Try something like:
communicate()[0]is stdout,communicate()[1]is stderr.