diff options
Diffstat (limited to 'blog/post-receive')
| -rwxr-xr-x | blog/post-receive | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/blog/post-receive b/blog/post-receive index 0721ce3b..f69abaf6 100755 --- a/blog/post-receive +++ b/blog/post-receive @@ -27,7 +27,9 @@ with tempfile.TemporaryDirectory() as tempdir: tempdir = pathlib.Path(tempdir) repo = tempdir / "repo" subprocess.run(["git", "worktree", "add", repo, pushed_commit], check=True) - blog = repo / "blog" - os.chdir(blog) - os.environ["PATH"] = "/home/alex/.local/bin:" + os.environ["PATH"] - subprocess.run(["./build.sh", dest], check=True) + try: + blog = repo / "blog" + os.environ["PATH"] = "/home/alex/.local/bin:" + os.environ["PATH"] + subprocess.run(["./build.sh", dest], check=True, cwd=blog) + finally: + subprocess.run(["git", "worktree", "remove", repo], check=True) |
