chore: cli handle failure logic in main method
This commit is contained in:
@@ -112,25 +112,15 @@ class ServiceCreator:
|
||||
project_path = Path(SERVICE_DEST_DIR / service.dir_name).resolve()
|
||||
logger.info(f"Generating uv.lock inside: {project_path}")
|
||||
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["uv", "lock"],
|
||||
cwd=project_path, # Changes the working directory for the command
|
||||
capture_output=True, # Captures stdout and stderr
|
||||
text=True, # Returns strings instead of raw bytes
|
||||
check=True, # Raises CalledProcessError if the exit code is non-zero
|
||||
)
|
||||
result = subprocess.run(
|
||||
["uv", "lock"],
|
||||
cwd=project_path, # Changes the working directory for the command
|
||||
capture_output=True, # Captures stdout and stderr
|
||||
text=True, # Returns strings instead of raw bytes
|
||||
check=True, # Raises CalledProcessError if the exit code is non-zero
|
||||
)
|
||||
|
||||
logger.info("Success! uv.lock has been generated/updated.")
|
||||
if result.stderr:
|
||||
# uv prints its progress and resolution metrics to stderr
|
||||
logger.warning(result.stderr.strip())
|
||||
|
||||
except FileNotFoundError:
|
||||
logger.error(
|
||||
"The 'uv' command-line tool is not installed or not in your PATH.",
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error("'uv lock' failed to execute successfully.")
|
||||
logger.error(f"Exit Code: {e.returncode}")
|
||||
logger.error(f"Details:\n{e.stderr}")
|
||||
logger.info("Success! uv.lock has been generated/updated.")
|
||||
if result.stderr:
|
||||
# uv prints its progress and resolution metrics to stderr
|
||||
logger.warning(result.stderr.strip())
|
||||
|
||||
Reference in New Issue
Block a user