From ffbbb4d8e39ef9794e0a717fcb49650ce3c35595 Mon Sep 17 00:00:00 2001 From: Phillip Verheyden Date: Wed, 15 Feb 2023 10:16:56 -0600 Subject: [PATCH] Add better debugging if hatch subprocess fails (#1672) --- scripts/otel_packaging.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/otel_packaging.py b/scripts/otel_packaging.py index c7765c10b7..2f42e44189 100644 --- a/scripts/otel_packaging.py +++ b/scripts/otel_packaging.py @@ -14,6 +14,7 @@ import os import subprocess +from subprocess import CalledProcessError import tomli @@ -28,12 +29,18 @@ def get_instrumentation_packages(): if not os.path.isdir(pkg_path): continue - version = subprocess.check_output( - "hatch version", - shell=True, - cwd=pkg_path, - universal_newlines=True, - ) + try: + version = subprocess.check_output( + "hatch version", + shell=True, + cwd=pkg_path, + universal_newlines=True, + ) + except CalledProcessError as exc: + print(f"Could not get hatch version from path {pkg_path}") + print(exc.output) + raise exc + pyproject_toml_path = os.path.join(pkg_path, "pyproject.toml") with open(pyproject_toml_path, "rb") as file: