Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 286162 | Differences between
and this patch

Collapse All | Expand All

(-)utils/org/eclipse/cdt/utils/pty/PTYInputStream.java (-4 / +4 lines)
Lines 14-20 Link Here
14
import java.io.IOException;
14
import java.io.IOException;
15
import java.io.InputStream;
15
import java.io.InputStream;
16
16
17
import org.eclipse.cdt.core.CCorePlugin;
18
import org.eclipse.cdt.utils.pty.PTY.MasterFD;
17
import org.eclipse.cdt.utils.pty.PTY.MasterFD;
19
18
20
class PTYInputStream extends InputStream {
19
class PTYInputStream extends InputStream {
Lines 74-82 Link Here
74
	public void close() throws IOException {
73
	public void close() throws IOException {
75
		if (master.getFD() == -1)
74
		if (master.getFD() == -1)
76
			return;
75
			return;
77
		int status = close0(master.getFD());
76
		close0(master.getFD());
78
		if (status == -1)
77
		// ignore error on close - see bug 286162
79
			throw new IOException(CCorePlugin.getResourceString("Util.exception.closeError")); //$NON-NLS-1$
78
//		if (status == -1)
79
//			throw new IOException(CCorePlugin.getResourceString("Util.exception.closeError")); //$NON-NLS-1$
80
		master.setFD(-1);
80
		master.setFD(-1);
81
	}
81
	}
82
82
(-)utils/org/eclipse/cdt/utils/spawner/Spawner.java (-11 / +22 lines)
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.

Return to bug 286162