> On 14 Apr 2025, at 21:48, Remi Forax <fo...@univ-mlv.fr> wrote: > > > Hi Ron, > i think you need to close the inputReader > > public static String output(String... args) { > ProcessBuilder processBuilder = new ProcessBuilder(args); > try { > Process process = processBuilder.start(); > try (BufferedReader reader = process.inputReader()) { > return reader.lines().collect(Collectors.joining("\n")); > } > } catch (IOException e) { > throw new IOError(e); > } > }
When the process terminates, the InputStream underlying the pipe is closed (after being drained and the unread bytes served by a ByteArrayInputStream), which *I think* should be sufficient, but I could be wrong. — Ron