Skip to content

Conversation

@epheien
Copy link
Contributor

@epheien epheien commented Jan 13, 2026

Summary

  • Fixed the process filtering logic in lua/opencode/cli/server.lua
  • Now correctly filters opencode processes by checking for the --port argument
  • This prevents false positives when multiple processes contain "opencode" in their command line

Changes

  • Updated the pgrep command to include -lfa flags and filter by --port argument
  • Changed PID extraction to properly parse the new pgrep -l output format

This fix ensures that only actual opencode server processes (those started with --port argument) are discovered, improving reliability when multiple processes with similar names are running.

@epheien epheien force-pushed the fix/filter-opencode-processes-by-port branch from 76979e0 to c014606 Compare January 13, 2026 15:41
@epheien
Copy link
Contributor Author

epheien commented Jan 13, 2026

The motivation for this modification is that under macOS, there are many opencode processes, which causes this plugin to be very slow when acquiring ports.

Xnip2026-01-13_23-42-55

@NickvanDyke NickvanDyke merged commit d849ba9 into NickvanDyke:main Jan 13, 2026
2 checks passed
@NickvanDyke
Copy link
Owner

Thanks for this! I guess the way I use opencode doesn't result in nearly as many processes (last I checked), but this seems great for some users! 😀

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.

2 participants