RFR: 8132541 : (process) ProcessBuilder support for redirection to discard output
Roger Riggs
Roger.Riggs at oracle.com
Mon Sep 21 18:28:57 UTC 2015
Hi Martin,
On 09/21/2015 02:18 PM, Martin Buchholz wrote:
> Thanks, I think this will be a popular feature, but...
>
> I'm not sure that all operating systems where Java may run will have
> such a "null file" (does OS400?).
True, but there are multiple ways to discard the output and it need not
be via the null file,
that's just easy on Unix and Windows.
The Redirect.file() method is allowed to return null and I've updated
the description to reinforce that for OS's that discard the output some
other way.
>
> If you're sure there is such a "null file", maybe there should be one
> or two methods added to File to return the null output and input
> files. Speaking of which, one might expect an analogue for "null
> input", giving you nothing but EOF, as with "command < /dev/null".
> You wouldn't want to call it DISCARD, though.
The requested function was to discard the output; and it was described
as easy
to close the InputStream to achieve the null input.
DISCARD can't be used for the null input because its type is 'WRITE'.
>
> If you added File.nullSink(), you could then do a
> Redirect.to(File.nullSink())
An alternative yes, but then for the input side it should be called
nullSource().
Roger
>
>
> On Mon, Sep 21, 2015 at 10:47 AM, Roger Riggs <Roger.Riggs at oracle.com
> <mailto:Roger.Riggs at oracle.com>> wrote:
>
> Ping?
>
> Can a Reviewer take a look and comment?
>
> Webrev:
> http://cr.openjdk.java.net/~rriggs/webrev-8132541-discard/
> <http://cr.openjdk.java.net/%7Erriggs/webrev-8132541-discard/>
>
>
> Thanks, Roger
>
>
>
> On 09/11/2015 01:11 PM, Remi Forax wrote:
>
> Great !,
> minor comments,
> nullFile should be NULL_FILE and @since 9 -> @since 1.9
>
> regards,
> Rémi
>
> ----- Mail original -----
>
> De: "Roger Riggs" <Roger.Riggs at Oracle.com>
> À: "Core-Libs-Dev" <core-libs-dev at openjdk.java.net
> <mailto:core-libs-dev at openjdk.java.net>>
> Envoyé: Vendredi 11 Septembre 2015 17:30:06
> Objet: RFR: 8132541 : (process) ProcessBuilder support for
> redirection to discard output
>
> Please review a proposed [1] ProcessBuilder addition to
> define a
> Redirect that will discard output.
> The implementation is to redirect output to /dev/null or
> NUL on Windows.
>
> Please review and comment if there are any unexpected side
> effects.
>
> Webrev:
> http://cr.openjdk.java.net/~rriggs/webrev-8132541-discard/
> <http://cr.openjdk.java.net/%7Erriggs/webrev-8132541-discard/>
>
> Issue:
> https://bugs.openjdk.java.net/browse/JDK-8132541
>
> Thanks, Roger
>
> [1]
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-July/034639.html
>
>
>
More information about the core-libs-dev
mailing list