← Back to context

Comment by Too

3 days ago

Nice rube goldberg machine. Apart from imports, that is equivalent to

    repo = "myorg/myrepo"
    tag = "v1.2.3+deadbeef"
    out = check_output(["git", "ls-remote", f"https://github.com/{repo}", f"refs/tags/{tag}"], cwd=os.path.expanduser("~/dev"), stderr=PIPE)

Converting exceptions to exits is an anti-pattern that hides the source of the error, f-strings has been a thing for 10 years and argument quoting happens automatically. Progress of output isn't visible in bash either when you capture output with $(), unless you "tee", which opens up another can of "pipefail"-worms.