Skip to content

Commit

Permalink
Merge pull request #14 from getsentry/iw/status-not-running
Browse files Browse the repository at this point in the history
fix(cli): Added status when service isn't running
  • Loading branch information
hubertdeng123 authored Sep 12, 2024
2 parents 863ac49 + b3cf304 commit 4e8904c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/commands/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ def status(args: Namespace) -> None:
service_config_file_path = os.path.join(
service.repo_path, DEVSERVICES_DIR_NAME, DOCKER_COMPOSE_FILE_NAME
)
output = f"Service: {service.name}\n\n"
mode_dependencies = " ".join(modes[mode_to_view])
status_json = run_docker_compose_command(
f"-f {service_config_file_path} ps {mode_dependencies} --format json"
).stdout
# If the service is not running, the status_json will be empty
if not status_json:
print(f"{service.name} is not running")
return
output = f"Service: {service.name}\n\n"
output += format_status_output(status_json)
output += "=" * LINE_LENGTH
sys.stdout.write(output + "\n")
Expand Down

0 comments on commit 4e8904c

Please sign in to comment.