Re: [External] : Re: My experience using Java to do CLI Scripting

2025-04-15 Thread Roger Riggs
Hi, The cleanup of Process state is handled by the implementation. On Linux it waits for the exitStatus and when the process exits, it captures the status, drains any pending input into local buffers and closes the file descriptors. When the streams and Process implementation are GC'd any rem

Re: [External] : Re: My experience using Java to do CLI Scripting

2025-04-15 Thread Stuart Marks
On 4/15/25 5:30 AM, Ron Pressler wrote: On 15 Apr 2025, at 10:51, fo...@univ-mlv.fr wrote: >> +1 for readAllInputLines() and readInputString() on Process. Wouldn’t it make more sense to add these to BufferedReader? Yes. Process already has four Reader-based overloads: - inputReader() -

Re: [External] : Re: My experience using Java to do CLI Scripting

2025-04-15 Thread Stuart Marks
On 4/14/25 11:52 PM, Cay Horstmann wrote: * How exactly do I use getInputStream()/inputReader() with *extreme care*, as the API doc warns me? Ah. This is referring to the following note in the Process.getInputStream() method spec: API Note: Use getInputStream() and inputReader() with

Re: [External] : Re: My experience using Java to do CLI Scripting

2025-04-15 Thread Ron Pressler
> On 14 Apr 2025, at 21:48, Remi Forax 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 (Buf

Re: [External] : Re: My experience using Java to do CLI Scripting

2025-04-15 Thread Ron Pressler
> On 15 Apr 2025, at 10:51, fo...@univ-mlv.fr wrote: > > - Original Message - >> From: "Stuart Marks" >> To: "Remi Forax" , "Ron Pressler" >> , "David Alayachew" >> >> Cc: "cay horstmann" , "core-libs-dev" >> >> Sent: Tuesday, April 15, 2025 12:10:54 AM >> Subject: Re: My experience

Re: [External] : Re: My experience using Java to do CLI Scripting

2025-04-15 Thread Ron Pressler
> On 15 Apr 2025, at 07:52, Cay Horstmann wrote: > > > > Il 14/04/25 23:46, Ron Pressler ha scritto: >>> On 14 Apr 2025, at 21:48, Remi Forax wrote: >>> >>> >>> Hi Ron, >>> i think you need to close the inputReader >>> >>> public static String output(String... args) { >>>ProcessBuild

Re: [External] : Re: My experience using Java to do CLI Scripting

2025-04-15 Thread forax
- Original Message - > From: "Ron Pressler" > To: "Remi Forax" > Cc: "cay horstmann" , "core-libs-dev" > , "David Alayachew" > > Sent: Monday, April 14, 2025 11:46:25 PM > Subject: Re: [External] : Re: My exper

Re: [External] : Re: My experience using Java to do CLI Scripting

2025-04-15 Thread Cay Horstmann
Il 14/04/25 23:46, Ron Pressler ha scritto: On 14 Apr 2025, at 21:48, Remi Forax 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 = proce

Re: [External] : Re: My experience using Java to do CLI Scripting

2025-04-15 Thread Bernd
on behalf of Cay Horstmann Sent: Tuesday, April 15, 2025 8:53 AMTo: Ron Pressler ; Remi Forax Cc: core-libs-dev ; David Alayachew Subject: Re: [External] : Re: My experience using Java to do CLI Scripting  Il 14/04/25 23:46, Ron Pressler ha scritto: > > >> On 14 Apr 2025, at 21:48