mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 04:55:22 +02:00
[249715] [dstore][shells] Unix shell does not echo command
This commit is contained in:
parent
8550cff10e
commit
91d6e55fa1
2 changed files with 11 additions and 49 deletions
|
@ -614,10 +614,6 @@ public class CommandMinerThread extends MinerThread
|
||||||
writer.newLine();
|
writer.newLine();
|
||||||
writer.flush();
|
writer.flush();
|
||||||
|
|
||||||
// for bug 249715 - keeping track of time of last input
|
|
||||||
// in order know when to stop waiting for output
|
|
||||||
_stdOutputHandler.setTimeOfLastInput(System.currentTimeMillis());
|
|
||||||
|
|
||||||
if (!_isWindows && (input.startsWith("cd ") || input.equals("cd"))) //$NON-NLS-1$ //$NON-NLS-2$
|
if (!_isWindows && (input.startsWith("cd ") || input.equals("cd"))) //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
{
|
{
|
||||||
queryCWD();
|
queryCWD();
|
||||||
|
@ -628,24 +624,10 @@ public class CommandMinerThread extends MinerThread
|
||||||
}
|
}
|
||||||
if (!_isWindows && !_isTTY)
|
if (!_isWindows && !_isTTY)
|
||||||
{
|
{
|
||||||
// special case for pattern interpretting
|
// always prompt after the command
|
||||||
// if cwd is not set, then files aren't resolved
|
|
||||||
// create mock prompt to ensure that they do get resolved
|
|
||||||
if (input.startsWith("cd ") || input.equals("cd")) //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
{
|
|
||||||
writer.write("echo $PWD'>'"); //$NON-NLS-1$
|
writer.write("echo $PWD'>'"); //$NON-NLS-1$
|
||||||
writer.newLine();
|
writer.newLine();
|
||||||
writer.flush();
|
writer.flush();
|
||||||
|
|
||||||
// sleep to allow reader to interpret before going on
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
catch (InterruptedException e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
|
|
|
@ -55,8 +55,6 @@ public class OutputHandler extends Handler {
|
||||||
|
|
||||||
private List _encodings;
|
private List _encodings;
|
||||||
|
|
||||||
// for bug 249715
|
|
||||||
private long _timeOfLastInput = 0;
|
|
||||||
|
|
||||||
public OutputHandler(DataInputStream reader, String qualifier,
|
public OutputHandler(DataInputStream reader, String qualifier,
|
||||||
boolean isTerminal, boolean isStdError, boolean isShell,
|
boolean isTerminal, boolean isStdError, boolean isShell,
|
||||||
|
@ -87,9 +85,6 @@ public class OutputHandler extends Handler {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeOfLastInput(long time){
|
|
||||||
_timeOfLastInput = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void handle() {
|
public void handle() {
|
||||||
|
@ -170,20 +165,6 @@ public class OutputHandler extends Handler {
|
||||||
|
|
||||||
// re-determine available if none available now
|
// re-determine available if none available now
|
||||||
if (available == 0) {
|
if (available == 0) {
|
||||||
|
|
||||||
if (!_isStdError && !_isTerminal){
|
|
||||||
long lastInput = _timeOfLastInput;
|
|
||||||
while (lastInput == _timeOfLastInput && _keepRunning && available == 0){ // once there's something new, we can stop waiting
|
|
||||||
Thread.sleep(500); // wait in case there is something
|
|
||||||
available = checkAvailable();
|
|
||||||
}
|
|
||||||
if (available == 0){
|
|
||||||
// it's possible that there is no output for something
|
|
||||||
// in the non-TTY case we need to prompt
|
|
||||||
return new String[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lookahead = _reader.read();
|
lookahead = _reader.read();
|
||||||
if (lookahead == -1) {
|
if (lookahead == -1) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -191,7 +172,6 @@ public class OutputHandler extends Handler {
|
||||||
available = _reader.available() + 1;
|
available = _reader.available() + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
byte[] readBytes = new byte[available];
|
byte[] readBytes = new byte[available];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue