diff options
Diffstat (limited to 'scripting/workben/installer')
-rw-r--r-- | scripting/workben/installer/ExecCmd.java | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/scripting/workben/installer/ExecCmd.java b/scripting/workben/installer/ExecCmd.java index 416d644fe126..fa5f9a8b2dcd 100644 --- a/scripting/workben/installer/ExecCmd.java +++ b/scripting/workben/installer/ExecCmd.java @@ -16,9 +16,10 @@ public class ExecCmd new Thread(new Runnable() { public void run() { + BufferedReader br_in = null; try { - BufferedReader br_in = new BufferedReader(new InputStreamReader(p.getInputStream())); + br_in = new BufferedReader(new InputStreamReader(p.getInputStream())); String buff = null; while ((buff = br_in.readLine()) != null) { @@ -29,7 +30,6 @@ public class ExecCmd } catch(Exception e) {}*/ } - br_in.close(); System.out.println("finished reading out"); } catch (IOException ioe) @@ -37,23 +37,45 @@ public class ExecCmd System.out.println("Exception caught printing javac result"); ioe.printStackTrace(); } + finally + { + if ( br_in != null ) + { + try + { + br_in.close(); + } + catch( Exception e ) {} // nothing can be done + } + } } } ).start(); new Thread(new Runnable() { public void run() { + BufferedReader br_err = null; try { - BufferedReader br_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + br_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); String buff = null; while ((buff = br_err.readLine()) != null) { System.out.println("Process err :" + buff); /*try {Thread.sleep(100); } catch(Exception e) {}*/ } - br_err.close(); System.out.println("finished reading err"); } catch (IOException ioe) { System.out.println("Exception caught printing javac result"); ioe.printStackTrace(); } + finally + { + if ( br_err != null ) + { + try + { + br_err.close(); + } + catch( Exception e ) {} // nothing can be done + } + } } }).start(); int exitcode = p.waitFor(); if ( exitcode != 0 ) |