1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 159803 - Console View Ignores EOF

Added statement to send end of transmission (ASCII 4) before close for
non-Windows PTY.

Change-Id: If98848a833f7619ce93277d05d39f3ba986a3cf4
Signed-off-by: Thomas Corbat <tcorbat@hsr.ch>
This commit is contained in:
Thomas Corbat 2015-09-09 09:08:31 +02:00 committed by Gerrit Code Review @ Eclipse.org
parent 74c21f5427
commit 2471f7e1d3
4 changed files with 22 additions and 4 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core.native;singleton:=true
Bundle-Version: 5.8.0.qualifier
Bundle-Version: 5.9.0.qualifier
Bundle-Activator: org.eclipse.cdt.internal.core.natives.CNativePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.8.0-SNAPSHOT</version>
<version>5.9.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.native</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -150,7 +150,7 @@ public class PTY {
}
in = new PTYInputStream(new MasterFD());
out = new PTYOutputStream(new MasterFD());
out = new PTYOutputStream(new MasterFD(), !isWinPTY);
}
/**

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2014 QNX Software Systems and others.
* Copyright (c) 2000, 2015 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -18,6 +18,9 @@ import org.eclipse.cdt.utils.pty.PTY.MasterFD;
public class PTYOutputStream extends OutputStream {
private static final byte EOT = '\4';
private boolean sendEotBeforeClose = false;
MasterFD master;
/**
@ -25,7 +28,19 @@ public class PTYOutputStream extends OutputStream {
* @param fd file descriptor.
*/
public PTYOutputStream(MasterFD fd) {
this(fd, false);
}
/**
* From a Unix valid file descriptor set a Reader.
* @param fd file descriptor.
* @param sendEotBeforeClose flags the stream to send an EOT character
* before closing the stream to signalize end of stream.
* @since 5.9
*/
public PTYOutputStream(MasterFD fd, boolean sendEotBeforeClose) {
master = fd;
this.sendEotBeforeClose = sendEotBeforeClose;
}
/**
@ -69,6 +84,9 @@ public class PTYOutputStream extends OutputStream {
public void close() throws IOException {
if (master.getFD() == -1)
return;
if (sendEotBeforeClose) {
write(EOT);
}
int status = close0(master.getFD());
if (status == -1)
throw new IOException("close error"); //$NON-NLS-1$