|
Lines 66-71
Link Here
|
| 66 |
OutputStream out; |
66 |
OutputStream out; |
| 67 |
InputStream in; |
67 |
InputStream in; |
| 68 |
InputStream err; |
68 |
InputStream err; |
|
|
69 |
private PTY fPty; |
| 69 |
|
70 |
|
| 70 |
public Spawner(String command, boolean bNoRedirect) throws IOException { |
71 |
public Spawner(String command, boolean bNoRedirect) throws IOException { |
| 71 |
StringTokenizer tokenizer = new StringTokenizer(command); |
72 |
StringTokenizer tokenizer = new StringTokenizer(command); |
|
Lines 92-97
Link Here
|
| 92 |
String dirpath = "."; //$NON-NLS-1$ |
93 |
String dirpath = "."; //$NON-NLS-1$ |
| 93 |
if (dir != null) |
94 |
if (dir != null) |
| 94 |
dirpath = dir.getAbsolutePath(); |
95 |
dirpath = dir.getAbsolutePath(); |
|
|
96 |
fPty = pty; |
| 95 |
exec_pty(cmdarray, envp, dirpath, pty); |
97 |
exec_pty(cmdarray, envp, dirpath, pty); |
| 96 |
} |
98 |
} |
| 97 |
/** |
99 |
/** |
|
Lines 144-151
Link Here
|
| 144 |
**/ |
146 |
**/ |
| 145 |
@Override |
147 |
@Override |
| 146 |
public InputStream getInputStream() { |
148 |
public InputStream getInputStream() { |
| 147 |
if(null == in) |
149 |
if(null == in) { |
| 148 |
in = new SpawnerInputStream(fChannels[1]); |
150 |
if (fPty != null) { |
|
|
151 |
in = fPty.getInputStream(); |
| 152 |
} else { |
| 153 |
in = new SpawnerInputStream(fChannels[1]); |
| 154 |
} |
| 155 |
} |
| 149 |
return in; |
156 |
return in; |
| 150 |
} |
157 |
} |
| 151 |
|
158 |
|
|
Lines 154-161
Link Here
|
| 154 |
**/ |
161 |
**/ |
| 155 |
@Override |
162 |
@Override |
| 156 |
public OutputStream getOutputStream() { |
163 |
public OutputStream getOutputStream() { |
| 157 |
if(null == out) |
164 |
if(null == out) { |
| 158 |
out = new SpawnerOutputStream(fChannels[0]); |
165 |
if (fPty != null) { |
|
|
166 |
out = fPty.getOutputStream(); |
| 167 |
} else { |
| 168 |
out = new SpawnerOutputStream(fChannels[0]); |
| 169 |
} |
| 170 |
} |
| 159 |
return out; |
171 |
return out; |
| 160 |
} |
172 |
} |
| 161 |
|
173 |
|
|
Lines 179-190
Link Here
|
| 179 |
} |
191 |
} |
| 180 |
try { |
192 |
try { |
| 181 |
if(null == err) |
193 |
if(null == err) |
| 182 |
((SpawnerInputStream)getErrorStream()).close(); |
194 |
getErrorStream().close(); |
| 183 |
if(null == in) |
195 |
if(null == in) |
| 184 |
((SpawnerInputStream)getInputStream()).close(); |
196 |
getInputStream().close(); |
| 185 |
if(null == out) |
197 |
if(null == out) |
| 186 |
((SpawnerOutputStream)getOutputStream()).close(); |
198 |
getOutputStream().close(); |
| 187 |
|
|
|
| 188 |
} catch (IOException e) { |
199 |
} catch (IOException e) { |
| 189 |
} |
200 |
} |
| 190 |
return status; |
201 |
return status; |
|
Lines 211-221
Link Here
|
| 211 |
// Close the streams on this side. |
222 |
// Close the streams on this side. |
| 212 |
try { |
223 |
try { |
| 213 |
if(null == err) |
224 |
if(null == err) |
| 214 |
((SpawnerInputStream)getErrorStream()).close(); |
225 |
getErrorStream().close(); |
| 215 |
if(null == in) |
226 |
if(null == in) |
| 216 |
((SpawnerInputStream)getInputStream()).close(); |
227 |
getInputStream().close(); |
| 217 |
if(null == out) |
228 |
if(null == out) |
| 218 |
((SpawnerOutputStream)getOutputStream()).close(); |
229 |
getOutputStream().close(); |
| 219 |
} catch (IOException e) { |
230 |
} catch (IOException e) { |
| 220 |
} |
231 |
} |
| 221 |
// Grace before using the heavy gone. |
232 |
// Grace before using the heavy gone. |