ProcessBuilder support for pipelines

Martin Buchholz martinrb at google.com
Tue Jul 28 16:46:54 UTC 2015


On Tue, Jul 28, 2015 at 2:36 AM, Florian Weimer <fweimer at redhat.com> wrote:

> On 07/28/2015 02:48 AM, Martin Buchholz wrote:
> > In the past, when I contemplated doing this, I generally thought that
> there
> > wasn't enough value in such a feature for the effort, given that one can
> > start a subprocess shell that supports pipelines.  Does this feature pull
> > its weight?
>
> Feeding program arguments to command spawned by a shell is difficult.
>

You know what would actually be really useful?

String shellQuote(List<String> args)

but that is Unix-shell specific, so historically difficult to convince JDK
maintainers to add.  But culture has changed towards the pragmatic...

I've already written such a thing, but not in Java.

There is also no good way to obtain the exit status of the first command
> in the pipe.  The last command in the pipe determines the shell exit
> status, and earlier commands are ignored.
>

Well, bash does have the "pipefail" feature.



More information about the core-libs-dev mailing list