Skip to content

bug: unable to find 'opencode' process due to invalid pgrep argument #136

@ilham-agustiawan

Description

@ilham-agustiawan

Did you check docs and existing issues?

  • I have read all the plugin docs
  • I have searched the existing issues
  • I have searched the existing opencode issues

Operating system/version

MacOS 26.2 (macos Tahoe)

:checkhealth opencode output

============================================================================== opencode: 2 ⚠️ opencode.nvim ~ - ✅ OK nvim version: 0.12.0-dev+g8754118213. - ✅ OK opencode.nvim git commit hash: f87e18f32a6451cc9dff6400b7bd36be842adf88. - ✅ OK vim.g.opencode_opts: { provider = { enabled = "snacks", tmux = {} } } opencode.nvim [binaries] ~ - ✅ OK opencode available with version 1.1.25. - ✅ OK curl available. - ✅ OK pgrep available. - ✅ OK lsof available. opencode.nvim [snacks] ~ - ✅ OK snacks.input is enabled: ask() will be enhanced. - ✅ OK blink.cmp is available: opts.ask.blink_cmp_sources will be registered in ask(). - ✅ OK snacks.picker is enabled: select() will be enhanced. opencode.nvim [providers] ~ - ✅ OK Configured opencode provider: snacks. - ✅ OK The snacks provider is available. - ⚠️ WARNING The kitty provider is not available — KITTY_LISTEN_ON environment variable is not set. - ADVICE: - Enable remote control in kitty. - ⚠️ WARNING The wezterm provider is not available — wezterm executable not found in $PATH. - ADVICE: - Install wezterm and ensure it's in your $PATH. - ✅ OK The tmux provider is available. - ✅ OK The terminal provider is available.

Describe the bug

This issue was introduced by PR #128, which added a pgrep argument that is invalid on my system.

When I try to run command manually pgrep -lfa 'opencode' | grep '[-]-port' 2>/dev/null || true, It returns the following "illegal option" error:

pgrep -lfa 'opencode' | grep '[-]-port' 2>/dev/null || true
pgrep: illegal option -- a
Usage: pgrep [-filLnvVx] [-d <delim>] [-g <pgrplist>] [-G <gidlist>] [-P <ppidlist>] [-t <termlist>] [-u <euidlist>] [-U <uidlist>] [<pattern>]

My installed pgrep version is

[I] agustiawan@agustiawan-silverbox ~/.con/nvim (main *%)> pgrep -V
pgrep (proctools 0.4pre1) http://proctools.sourceforge.net
[I] agustiawan@agustiawan-silverbox ~/.con/nvim (main *%)> which pgrep
/opt/homebrew/bin/pgrep

Related code:

local pgrep_output = exec("pgrep -lfa 'opencode' | grep '[-]-port' 2>/dev/null || true")
if pgrep_output == "" then
return {}
end

Steps To Reproduce

Run OpenCode.ask with any prompt

Expected Behavior

Run as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions