Skip to content

process-detector: ps command and path splitting broken on Windows #31

@blueberrycongee

Description

@blueberrycongee

Problem

electron/process-detector.ts has two Unix-only assumptions that make the entire module non-functional on Windows:

1. ps command does not exist on Windows (line 119)

execFile("ps", ["-eo", "pid,ppid,args"], (err, stdout) => { ... })

ps -eo pid,ppid,args is a Unix command. On Windows this throws ENOENT. The entire detectCli() function fails immediately.

2. Path splitting only handles forward slashes (line 26)

const baseName = firstToken.split("/").pop() ?? "";

Windows paths like C:\Program Files\nodejs\node.exe are not split on \, so baseName retains the full path string. This causes wrapper detection (WRAPPER_NAMES.has(baseName)) and CLI pattern matching to fail.

Windows alternatives for process enumeration

  • Get-CimInstance Win32_Process | Select ProcessId,ParentProcessId,CommandLine — exposes all three required fields (PID, PPID, CommandLine)
  • tasklist /fo csv /v — available by default but lacks ParentProcessId and full CommandLine
  • wmic process get ProcessId,ParentProcessId,CommandLine /format:csv — deprecated, removed from newer Windows

Affected functionality

  • CLI tool detection (claude, codex, etc.) in terminal tabs
  • Process tree traversal for session tracking

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwindowsWindows platform specific

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions