From e4550d45671fd37a8aba2969c463d4ad7fce2ff5 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Fri, 16 Oct 2026 22:47:06 +0200 Subject: [PATCH] Destroy the helper process in NodeJsManager.executeCommand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit executeCommand only closed the stdout reader of the process it started, so the processes used to locate Node.js through a login shell and to run node -v were never destroyed and their stderr pipe was never drained. The process is now started with stderr discarded and destroyed after the first output line has been read. Assisted-by: multiple AI agents and layers of automated tooling 🤖 --- .../copilot/eclipse/core/lsp/NodeJsManager.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/NodeJsManager.java b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/NodeJsManager.java index 4aba19933..9d43e8927 100644 --- a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/NodeJsManager.java +++ b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/NodeJsManager.java @@ -304,12 +304,19 @@ private static boolean validateNodeVersion(File nodeJsLocation) { */ private static String executeCommand(String[] command) { String result = null; - try (BufferedReader reader = new BufferedReader( - new InputStreamReader(Runtime.getRuntime().exec(command).getInputStream()))) { - result = reader.readLine(); + Process process = null; + try { + process = new ProcessBuilder(command).redirectError(ProcessBuilder.Redirect.DISCARD).start(); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { + result = reader.readLine(); + } } catch (IOException e) { Activator.getDefault().getLog() .log(new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), e.getMessage(), e)); + } finally { + if (process != null) { + process.destroy(); + } } return result; }