Use PowerShell instead of WMIC for detecting zombie process on Windows by jbliznak · Pull Request #3258 · apache/maven-surefire (original) (raw)

@jbliznak

WMIC is not available in recent Windows versions. The new solution with PowerShell should work for Windows 8 and newer and Windows Server 2012 and newer.

The change is deliberately as small as possible, leaving most of the old WMIC handling in place because there is a plan to deprecate this class anyway.

On performance note: executing the check via PowerShell is notably slower than with WMIC (low hundreds of millis vs tens of millis). However, since this check is used only to detect zombie process and only once per tens of seconds, this will hopefully be good enough. Much better and faster implementation could be done once the minimal supported Java moves to 9 or later via ProcessHandle, until then this should do.