commit 67edb8d525d0931ed423e6cc7fdd0778b8d11823 parent 8f5bfa4f042fd9b471a4e870d69a9abde6d10b2e Author: Florian Dold <florian.dold@gmail.com> Date: Fri, 4 Mar 2016 15:23:07 +0100 githook Diffstat:
| M | githooks/merchant/post-receive | | | 15 | +++++++++++---- |
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/githooks/merchant/post-receive b/githooks/merchant/post-receive @@ -5,13 +5,20 @@ import os lines = sys.stdin.readlines() -updated = {} +updated = set() for line in lines: - old, new, name = line.split() + try: + old, new, name = line.split() + except ValueError: + print("unexpected format") + os.exit(1) updated.add(name) if "refs/heads/test" in updated: - os.system("echo merchant | timeout 1s tee rebuild") - print("updating merchant") + ret = os.system("echo merchant | timeout 1s tee /home/test/rebuild >/dev/null") + if ret != 0: + print("merchant update failed") + else: + print("updating merchant")