Skip to content

fix: PowerShell fallback when wmic is unavailable on Windows (0.6.1)#32

Merged
simonepri merged 2 commits into
mainfrom
fix/windows-wmic-removal
Jun 8, 2026
Merged

fix: PowerShell fallback when wmic is unavailable on Windows (0.6.1)#32
simonepri merged 2 commits into
mainfrom
fix/windows-wmic-removal

Conversation

@simonepri

@simonepri simonepri commented Jun 8, 2026

Copy link
Copy Markdown
Owner

wmic was removed from Windows 11 24H2 and Windows Server 2025, so pidtree throws spawn wmic ENOENT on those machines (#18, #20, #26, #31).

On Windows it now tries wmic first and falls back to PowerShell (Get-CimInstance Win32_Process) when wmic isn't found, so there's no slowdown where wmic still exists. The command is passed via -EncodedCommand to avoid arg-quoting issues, and $ProgressPreference is silenced so PowerShell's progress output isn't mistaken for an error on stderr.

Kept as a non-breaking 0.6.1: still CJS, zero deps, same API. The ESM / Node 18 / toolchain refresh is a separate follow-up.

Added unit tests for the parser and the fallback. CI is also updated in a second commit: the old Node matrix (4–14) no longer installs on current runners, so it now tests 18–current. The Windows job runs on Server 2025, which has no wmic, so its integration suite exercises the fallback directly. The lint job is pinned to Node 14, where the legacy xo still runs (the toolchain update will fix that properly).

Supersedes #30, which took the same PowerShell route.

@simonepri simonepri force-pushed the fix/windows-wmic-removal branch from b54ed8d to 0f9f83b Compare June 8, 2026 08:35
@simonepri simonepri force-pushed the fix/windows-wmic-removal branch 2 times, most recently from 8eb1680 to 46b15a6 Compare June 8, 2026 08:54
simonepri added 2 commits June 8, 2026 11:03
wmic was removed in Windows 11 24H2 and Server 2025. Try wmic first,
then Get-CimInstance via PowerShell when it's not found.

Closes #18, #20, #26, #31
Old Node (4-14) no longer installs on current runners (no arm64 builds
on macOS), so test the supported 18-current range instead. Pin the lint
job to Node 14 where the legacy xo still runs.
@simonepri simonepri force-pushed the fix/windows-wmic-removal branch from 46b15a6 to 8f48da7 Compare June 8, 2026 09:03
@simonepri simonepri merged commit 6df6555 into main Jun 8, 2026
13 checks passed
@simonepri simonepri deleted the fix/windows-wmic-removal branch June 8, 2026 09:11
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