1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Close the master pty when done.

This commit is contained in:
Alain Magloire 2002-09-07 02:00:33 +00:00
parent 52b2e88105
commit 035aac8223

View file

@ -42,9 +42,11 @@ public class MIInferior extends Process {
PipedInputStream err;
PipedOutputStream errPiped;
PTY pty;
MIInferior(MISession mi, PTY pty) {
MIInferior(MISession mi, PTY p) {
session = mi;
pty = p;
if (pty != null) {
out = pty.getOutputStream();
in = pty.getInputStream();
@ -59,7 +61,7 @@ public class MIInferior extends Process {
out = new OutputStream() {
StringBuffer buf = new StringBuffer();
public void write(int b) throws IOException {
buf.append(b);
buf.append((char)b);
if (b == '\n') {
flush();
}
@ -230,6 +232,27 @@ public class MIInferior extends Process {
} catch (IOException e) {
e.printStackTrace();
}
// If pty is not null then we are using a master/slave terminal
// emulation close the master to notify the slave.
if (pty != null) {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
in = null;
}
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
out = null;
}
}
session.fireEvent(new MIInferiorExitEvent());
notifyAll();
}