Skip to content

Conversation

@hubertdeng123
Copy link
Member

If docker daemon not running, attempt to start it with devenv colima start

@hubertdeng123 hubertdeng123 requested a review from joshuarli August 8, 2025 21:50
@codecov
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.21%. Comparing base (42050ef) to head (c6eabd7).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #293      +/-   ##
==========================================
+ Coverage   95.19%   95.21%   +0.01%     
==========================================
  Files          28       28              
  Lines        2644     2652       +8     
==========================================
+ Hits         2517     2525       +8     
  Misses        127      127              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +35 to 39
try:
subprocess.run(["devenv", "colima", "start"], check=True)
except subprocess.CalledProcessError as e:
console.failure("Failed to start colima")
raise DockerDaemonNotRunningError from e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: The `try...except` block for `devenv colima start` only handles `CalledProcessError`, risking an unhandled `FileNotFoundError` if the `devenv` command is missing.
  • Description: The subprocess.run call to start devenv colima is wrapped in a try...except block that only catches subprocess.CalledProcessError. However, subprocess.run can also raise a FileNotFoundError if the devenv executable is not found in the system's PATH. This unhandled exception would propagate up, causing a crash with a raw traceback instead of the expected DockerDaemonNotRunningError. This violates the function's contract and prevents graceful failure handling for callers expecting that specific exception type.
  • Suggested fix: Broaden the except clause to catch (subprocess.CalledProcessError, FileNotFoundError). This ensures that if the devenv command is missing, the function still raises the expected DockerDaemonNotRunningError, maintaining consistent error handling.
    severity: 0.65, confidence: 0.9

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hubertdeng123 hubertdeng123 merged commit a63608c into main Aug 12, 2025
15 checks passed
@hubertdeng123 hubertdeng123 deleted the hubertdeng123/auto-start-colima branch August 12, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants