RFR 8142927: Feed some text to STDIN in ProcessTools.executeProcess()

Wang Weijun weijun.wang at oracle.com
Sat Nov 14 03:22:43 UTC 2015


> On 2015年11月13日, at 下午9:44, Roger Riggs <Roger.Riggs at oracle.com> wrote:
> 
> Hi Max,
> 
> It would be cleaner to create and use a PrintStream to send the bytes
> to the process.  We don't want to encourage the poor practice of using getBytes().

Like this?

  http://cr.openjdk.java.net/~weijun/8142927/webrev.01/

> Please also document that the exit status of the process is ignored.

It is not really ignored. Process remembers it and OutputAnalyzer can retrieve it later.

Thanks
Max

> 
> Roger
> 
> 
> On 11/13/15 3:21 AM, Wang Weijun wrote:
>> Hi All
>> 
>> 8142927: Feed some text to STDIN in ProcessTools.executeProcess()
>> http://cr.openjdk.java.net/~weijun/8142927/webrev.00/
>> 
>> With this change, you can call
>> 
>>   ProcessTools.executeProcess(new ProcessBuilder("keytool -printcert", certInAscii)
>> 
>> which means "echo $certInAscii | keytool -printcert".
>> 
>> Not sure if there is already an existing way to do this easily. Or maybe someone might think byte[] is better.
>> 
>> Do I need to write a test for testlibrary?
>> 
>> Thanks
>> Max
>> 
>> 
>> 
> 




More information about the core-libs-dev mailing list