- Timestamp:
- 2017-04-21T21:09:08+12:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/download/ServerInfoDialog.java
r31629 r31636 15 15 import org.greenstone.gatherer.greenstone.LocalGreenstone; 16 16 import org.greenstone.gatherer.gui.*; 17 import org.greenstone.gatherer.util.SafeProcess; 17 18 import org.greenstone.gatherer.util.Utility; 18 19 … … 105 106 try { 106 107 String [] env = null; 107 Process prcs = null; 108 Runtime rt = Runtime.getRuntime(); 108 SafeProcess prcs = null; 109 109 110 110 if (Utility.isWindows()) { 111 prcs = rt.exec(command); 111 prcs = new SafeProcess(command); 112 112 } 113 113 else { … … 121 121 env[2] = "GSDLHOME=" + Configuration.gsdl_path; 122 122 env[3] = "GSDLOS=" + Gatherer.client_operating_system; 123 prcs = rt.exec(command, env);123 prcs = new SafeProcess(command, env, null); 124 124 } 125 125 else { 126 126 // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set 127 prcs = rt.exec(command);127 prcs = new SafeProcess(command); 128 128 } 129 129 } 130 131 InputStreamReader isr = new InputStreamReader(prcs.getErrorStream()); 132 BufferedReader br = new BufferedReader(isr); 133 String line; 134 // Capture the standard error stream and seach for two particular occurences. 135 while ((line = br.readLine()) != null && !line.trim().equals("<<Finished>>")) { 136 137 JLabel a_label = new JLabel(line); 138 a_label.setAlignmentX(Component.LEFT_ALIGNMENT); 139 info_list_pane.add(a_label); 140 } 130 131 // special processing of Process' stderr stream: 132 // Search the process standard error stream and seach for two particular occurences. 133 int exitVal = prcs.runProcess(null, new ProcErrStreamLineByLineHandler()); 141 134 142 135 } catch (Exception ioe) { … … 146 139 } 147 140 141 private class ProcErrStreamLineByLineHandler extends SafeProcess.LineByLineHandler 142 { 143 public ProcErrStreamLineByLineHandler() { 144 super(SafeProcess.STDERR); // sets this.source 145 } 146 147 public void gotLine(String line) { 148 // Check the current line from the standard error stream and seach for two particular occurences. 149 if (!line.trim().equals("<<Finished>>")) { 150 151 JLabel a_label = new JLabel(line); 152 a_label.setAlignmentX(Component.LEFT_ALIGNMENT); 153 ServerInfoDialog.this.info_list_pane.add(a_label); 154 } 155 } 156 public void gotException(Exception e) { 157 e.printStackTrace(); 158 } 159 } 148 160 }
Note:
See TracChangeset
for help on using the changeset viewer.