Skip to content

Commit 83a1f72

Browse files
committed
Fix Windows Defender status retrieval under Java-25 or later
Fixes errors like: ''' Failed to obtain 'WinDefend' service state java.io.IOException: Process timed-out and it was attempted to forcefully terminate it '''
1 parent 195df72 commit 83a1f72

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WindowsDefenderConfigurator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.concurrent.ExecutorService;
3232
import java.util.concurrent.Executors;
3333
import java.util.concurrent.Future;
34+
import java.util.concurrent.TimeUnit;
3435
import java.util.stream.Collectors;
3536
import java.util.stream.Stream;
3637
import org.eclipse.core.runtime.CoreException;
@@ -389,7 +390,7 @@ private static List<String> runProcess(List<String> command, IProgressMonitor mo
389390
Thread.onSpinWait();
390391
Thread.sleep(5);
391392
}
392-
if (process.isAlive()) {
393+
if (!process.waitFor(5, TimeUnit.SECONDS)) {
393394
process.destroyForcibly();
394395
process.descendants().forEach(ProcessHandle::destroyForcibly);
395396
throw new IOException("Process timed-out and it was attempted to forcefully terminate it"); //$NON-NLS-1$

0 commit comments

Comments
 (0)