-
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 using Java to do CLI Scripting
A few points
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()
-
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
> 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
t; , "core-libs-dev"
>>
>> Sent: Tuesday, April 15, 2025 12:10:54 AM
>> Subject: Re: My experience using Java to do CLI Scripting
>>
>> A few points here...
>>
>> It might be possible to get away without any Process-related cleanup. For
>> one,
- 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
> 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
- 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
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
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
On 4/14/25 1:48 PM, Remi Forax wrote:
From: "Ron Pressler"
This does what you want (and could even be combined to a single expression):
Process p = new ProcessBuilder("ls", "-al").start();
String result = p.inputReader().lines().collect(Collectors.joining("\n"));
and it’s even nicer
- Original Message -
> From: "Ron Pressler"
> To: "cay horstmann"
> Cc: "core-libs-dev" , "David Alayachew"
>
> Sent: Monday, April 14, 2025 10:30:40 PM
> Subject: Re: My experience using Java to do CLI Scripting
> (mov
(moved from amber-dev)
Hi.
This does what you want (and could even be combined to a single expression):
Process p = new ProcessBuilder("ls", "-al").start();
String result = p.inputReader().lines().collect(Collectors.joining("\n"));
and it’s even nicer in the cases where you may want to
13 matches
Mail list logo