Skip to content

Conversation

@lurongjiang
Copy link

Description

ccr code command fails to start correctly when the configured port is already in use. Previously, when ccr code was executed and the service wasn't detected as running, it would attempt to start a background service. However, if the port was already occupied
by another process (or a zombie process from a previous run), the service startup would timeout without providing any indication that the issue was a port conflict. This led to confusing "startup timeout" errors that were difficult to debug.

Fix

The core issue has been resolved by adding port availability checks before attempting to start the
service in all relevant commands:

  • Added isPortAvailable function in a new utility module to check port status
  • Implemented port checking in the main run() function in src/index.ts before starting the server
  • Added import for the new port checking utility
  • Updated error messaging to provide clear indication when a port is already in use

Changes

  • New file: src/utils/portCheck.ts - Contains port availability checking functions
  • Modified: src/index.ts - Added port checking logic before server startup with appropriate error handling
  • Now provides clear error message when port is already in use instead of generic timeout error

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.

1 participant