Skip to content

fix(store): compare editor process names exactly, never as substrings of the joined listing (#99) - #101

Merged
renezander030 merged 1 commit into
masterfrom
fix/editor-open-npx-false-positive
Aug 30, 2026
Merged

renezander030 merged 1 commit into
masterfrom
fix/editor-open-npx-false-positive

Conversation

@renezander030

Copy link
Copy Markdown
Owner

Fixes #99.

editorProcesses() substring-matched the joined process listing, so npm's rewritten process title (npm exec capcut-cli@0.21.0 …) made the CLI detect itself as a running editor and refuse every mutating command on the documented zero-install path, with CapCut closed.

Change (src/store.ts): the raw listing is parsed per line by a new pure helper, matchEditorProcesses(listing, flavor), and compared exactly, case-insensitively:

  • posix: exact basename of each ps -axo comm= line — not whole-line equality, because macOS prints the executable's full bundle path there (/Applications/CapCut.app/Contents/MacOS/CapCut), and the existing fake-editor test spawns by absolute path and relies on it.
  • win32: the exact tasklist /FO CSV image name (first quoted field). Same substring shape as the posix branch; it couldn't false-positive under npx (image name is node.exe) but matched any image name merely containing capcut.exe.

Tests (test/editor-processes.test.mjs): the reporter's fixture as written — a listing whose only capcut is the npm exec capcut-cli@0.21.0 … title returns [] — plus the macOS bundle path still detecting, bare Linux comm names, contains-but-not-equals names (MyCapCut, capcut-sync, CapCut Helper (Renderer)), the win32 CSV row, and empty listings. The live guard test in sync-timelines.test.mjs (real ps, fake CapCut binary) still passes unchanged.

Full suite: 852/852, biome clean. Docs: changelog entry, README release notes rotated in both languages, version 0.21.1.

@renezander030
renezander030 merged commit a4f51f3 into master Aug 30, 2026
8 checks passed
@renezander030
renezander030 deleted the fix/editor-open-npx-false-positive branch August 30, 2026 07:45
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.

editor-open guard false-positives under npx: editorProcesses() substring-matches the whole ps listing and detects its own npm process

1 participant