This is the test result on Ubuntu. The outcome is that the errorCode is
irelevant for us, and the command is crashed on unknown binary if started
command throws IOException and this is important in order to continue with
PING after the first crash.

1. This is the case when the PID exists but the command is not found on the
system:
Let's rename ps to psx which simulates that the ps does not exist.
java.io.IOException: Cannot run program "psx": Exec failed, error: 2 (No
such file or directory)
This behavior is the same in Windows.

2. This is case when PID does not exists but the command exists:
No values, no numbers because the process does not exist.
$ ps -p 3026
    PID TTY          TIME CMD
ProcessBuilder.waitFor() returns exit code 1. This behavior is
different from Windows which returns exit code 0. In both cases
the result values are missing.

3. Finally, the happy case:
Found a process by PID 3025:
$ ps -p 3025
 PID TTY          TIME CMD
3025 ?        00:03:18 idea`





On Fri, Feb 13, 2026 at 10:43 PM Tibor Digaňa <[email protected]>
wrote:

> It does not matter if you are calling WMIC or PowerShell because both
> might be unavailable on the system.
> The point here is that I designed the utility so that the first crash of
> the native command should fallback to PING which is platform independent
> mechanism.
>
> I downloaded the appliance `WinDev2407Eval.ova` and created VM in
> VirtualBox. It contains Microsoft Windows 11 Enterprise Evaluation. WMIC
> was officially deprecated in Windows 10, it should not be shipped with
> Windows 11 (22H2+) but the reality is different because my Windows 11
> Enterprise Evaluation (22H2).
>
> PowerShell is not installed and enabled by default:
> `pwsh --version`
> ```'pwsh' is not recognized as an internal or external command,
> operable program or batch file.```
>
> Windows 11 contains `tasklist.exe` but Windows XP Home does not have
> `tasklist.exe` binary installed but XP Professional contains tasklist.
>
> `$ wmicx process where ProcessId=3092`
> ```No Instance(s) Available.
> java.io.IOException: Cannot run program "wmicx": CreateProcess error=2,
> The system cannot find the file specified```
>
> `$ tasklist /M /FI "pid eq 3093"`
> ```INFO: No tasks are running which match the specified criteria.```
>
> `$ wmic process where ProcessId=3093`
> ProcessBuilder.waitFor() returns exit code 0
>
>
> `$ tasklist /M /FI "pid eq 3092"`
> ```Image Name    PID Modules
> ============ ============
> svchost.exe      3092 N/A```
>
> `$ wmic process where ProcessId=3092`
> ```Caption      ProcessId
> svchost.exe  3092```
> ProcessBuilder.waitFor() returns exit code 0
>
> On Fri, Feb 13, 2026 at 10:42 PM Tibor Digaňa <[email protected]>
> wrote:
>
>> Actually, there is one more thing!   Nobody said that.
>> The little tiny code was designed so, that, when either PS or WMIC fails,
>> then the PING is the fallback.
>> It's different when the command fails due to the process with the
>> particular PID does not exist, and it is different story when the WMIC or
>> PS itself has a serious system problem.
>> So, maybe it is wrong to start coding a fix if you do not have Windows.
>> First you must have experiences with this and understand what's going on.
>> The Forked JVM is immediately exited because the first check fails eagerly
>> and it could not fallback to the PING mechanism.
>> Most probably this is the problem.
>>
>> On Sat, Feb 7, 2026 at 1:21 AM Tibor Digaňa <[email protected]>
>> wrote:
>>
>>> Hi all,
>>>
>>> I would like to have your opinion regarding this issue reported on
>>> GitHub:
>>> "Surefire and Failsafe stop working on latest versions of Windows due to
>>> missing wmic"
>>> Please see the link here
>>> https://github.com/apache/maven-surefire/issues/3176
>>>
>>> I am the author who developed the PPID Process Checker. When I worked on
>>> it together with Michael Osipov, we reached a consensus. It was a very nice
>>> personal collaboration, and now I would be glad to have this guy back in
>>> the active Maven Team again :-)
>>> That time we used Java 7 or Java 8, or even both, however Java 9 was
>>> available in the world. We could not use the Java 9 however it could really
>>> help us. Therefore we decided to call the system library "wmic" on Windows,
>>> and "ps" on *Nix world, and not Java 9.
>>>
>>> Due to the Microsoft Windows removed "wmic", I am open to move complete
>>> Surefire project under Java 9.
>>>
>>> I remember how problematic life it was when we had to support both Java
>>> 7 and Java 8 at the same time. I do not want to support two Java versions
>>> again.
>>> It would be easier for us to get a confidence from the Maven community
>>> and switch to Java 9 directly.
>>> I hope we would get an exception in the list of Maven plugins.
>>>
>>> BTW, One more remark. There are strengths to destroy this project. Let's
>>> ignore these strengths. We can prevent from this happening if we are
>>> positive and we are friendly working together.
>>>
>>>
>>> Cheers
>>> Tibor17
>>>
>>

Reply via email to