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:
parent
74c21f5427
commit
2471f7e1d3
4 changed files with 22 additions and 4 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.core.native;singleton:=true
|
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-Activator: org.eclipse.cdt.internal.core.natives.CNativePlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>5.8.0-SNAPSHOT</version>
|
<version>5.9.0-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.cdt.core.native</artifactId>
|
<artifactId>org.eclipse.cdt.core.native</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -150,7 +150,7 @@ public class PTY {
|
||||||
}
|
}
|
||||||
|
|
||||||
in = new PTYInputStream(new MasterFD());
|
in = new PTYInputStream(new MasterFD());
|
||||||
out = new PTYOutputStream(new MasterFD());
|
out = new PTYOutputStream(new MasterFD(), !isWinPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* 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 {
|
public class PTYOutputStream extends OutputStream {
|
||||||
|
|
||||||
|
private static final byte EOT = '\4';
|
||||||
|
private boolean sendEotBeforeClose = false;
|
||||||
|
|
||||||
MasterFD master;
|
MasterFD master;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +28,19 @@ public class PTYOutputStream extends OutputStream {
|
||||||
* @param fd file descriptor.
|
* @param fd file descriptor.
|
||||||
*/
|
*/
|
||||||
public PTYOutputStream(MasterFD fd) {
|
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;
|
master = fd;
|
||||||
|
this.sendEotBeforeClose = sendEotBeforeClose;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,6 +84,9 @@ public class PTYOutputStream extends OutputStream {
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
if (master.getFD() == -1)
|
if (master.getFD() == -1)
|
||||||
return;
|
return;
|
||||||
|
if (sendEotBeforeClose) {
|
||||||
|
write(EOT);
|
||||||
|
}
|
||||||
int status = close0(master.getFD());
|
int status = close0(master.getFD());
|
||||||
if (status == -1)
|
if (status == -1)
|
||||||
throw new IOException("close error"); //$NON-NLS-1$
|
throw new IOException("close error"); //$NON-NLS-1$
|
||||||
|
|
Loading…
Add table
Reference in a new issue