8dad7446dbcb66c6e08616d9211d4bb9802e39a0 — Drew DeVault 5 days ago b302192 master
semver: abort if _incr_version fails
1 files changed, 6 insertions(+), 2 deletions(-)

M bin/semver
M bin/semver => bin/semver +6 -2
@@ 37,10 37,14 @@ else:
          new_version = f"{major}.{minor}.{patch}"
  
+ p = None
  if os.path.exists("contrib/_incr_version"):
-     subprocess.run(["contrib/_incr_version", describe, new_version])
+     p = subprocess.run(["contrib/_incr_version", describe, new_version])
  elif os.path.exists(".git/_incr_version"):
-     subprocess.run([".git/_incr_version", describe, new_version])
+     p = subprocess.run([".git/_incr_version", describe, new_version])
+ if p.returncode != 0:
+     print("Error: _incr_version returned nonzero exit code")
+     sys.exit(1)
  
  with tempfile.NamedTemporaryFile() as f:
      basename = os.path.basename(os.getcwd())