diff options
author | Denis Laxalde <denis@laxalde.org> | 2019-06-23 11:06:54 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-06-23 13:48:18 -0400 |
commit | 6dff624f0d92dd1f6e44f4adb62fa763b241834a (patch) | |
tree | d7f1b5eb1de606db628f8da572d732c88b13dcbe | |
parent | 544a50468caf0332ca247fc59b8ba7cbd21e293c (diff) |
Check subprocesses exit code in repo init
We add check=True to subprocess.run() calls in GitRepoApi.do_init_repo()
so that an exception (CalledProcessError) will be raised at first error
of subprocesses chain.
-rw-r--r-- | gitsrht/repos.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gitsrht/repos.py b/gitsrht/repos.py index 2cc7d27..1259465 100644 --- a/gitsrht/repos.py +++ b/gitsrht/repos.py @@ -14,17 +14,17 @@ class GitRepoApi(SimpleRepoApi): repository_class=Repository) def do_init_repo(self, owner, repo): - subprocess.run(["mkdir", "-p", repo.path], + subprocess.run(["mkdir", "-p", repo.path], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - subprocess.run(["git", "init", "--bare"], cwd=repo.path, + subprocess.run(["git", "init", "--bare"], cwd=repo.path, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - subprocess.run(["git", "config", "srht.repo-id", str(repo.id)], + subprocess.run(["git", "config", "srht.repo-id", str(repo.id)], check=True, cwd=repo.path, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) subprocess.run(["ln", "-s", post_update, os.path.join(repo.path, "hooks", "update") - ], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + ], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) subprocess.run(["ln", "-s", post_update, os.path.join(repo.path, "hooks", "post-update") - ], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + ], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) |