[rfc][icedtea-web] replace runtime().exec by processbuilder

Andrew Azores aazores at redhat.com
Mon Jun 15 15:46:46 UTC 2015


On 15/06/15 11:34 AM, Jiri Vanek wrote:
> ssia
>
>
> I'm also in temptation to push this to 1.6
>
> The handling of streams is just terrible :(
>
>
> J.

> -            Process p = Runtime.getRuntime().exec(command);
> -            new StreamEater(p.getErrorStream()).start();
> -            new StreamEater(p.getInputStream()).start();
> -            p.getOutputStream().close();
> -
> +            ProcessBuilder pb = new ProcessBuilder(command);
> +            pb.inheritIO();
> +            Process p =pb.start();
> +            try {
> +                p.waitFor();
> +            } catch (InterruptedException e) {
> +                OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e);
> +            }

Where does the "waitFor" come from? I'm not seeing that the old code 
does the same thing (but maybe I'm just missing it and it does). Is this 
meant to be a change in behaviour? If that InterruptedException does get 
thrown, is it ok that the current thread continues on in parallel with 
process p?

-- 
Thanks,

Andrew Azores



More information about the distro-pkg-dev mailing list