1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 13:05:22 +02:00

[302174] [dstore] shell init command can potentially get called too late

This commit is contained in:
David McKnight 2010-02-08 18:41:06 +00:00
parent 57b4e6d029
commit 59ad1c4786

View file

@ -25,6 +25,7 @@
* David McKnight (IBM) [290743] [dstore][shells] allow bash shells and custom shell invocation * David McKnight (IBM) [290743] [dstore][shells] allow bash shells and custom shell invocation
* David McKnight (IBM) [287305] [dstore] Need to set proper uid for commands when using SecuredThread and single server for multiple clients[ * David McKnight (IBM) [287305] [dstore] Need to set proper uid for commands when using SecuredThread and single server for multiple clients[
* Peter Wang (IBM) [299422] [dstore] OutputHandler.readLines() not compatible with servers that return max 1024bytes available to be read * Peter Wang (IBM) [299422] [dstore] OutputHandler.readLines() not compatible with servers that return max 1024bytes available to be read
* David McKnight (IBM) [302174] [dstore] shell init command can potentially get called too late
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.command; package org.eclipse.rse.internal.dstore.universal.miners.command;
@ -61,6 +62,34 @@ import org.eclipse.rse.internal.dstore.universal.miners.command.patterns.Pattern
*/ */
public class CommandMinerThread extends MinerThread public class CommandMinerThread extends MinerThread
{ {
class InitRunnable implements Runnable
{
private boolean _done = false;
private String _initCmd;
public InitRunnable(String command){
_initCmd = command;
}
public boolean isDone(){
return _done;
}
public void run()
{
// wait a second so the profile can complete startup
try {
sleep(1000);
}
catch (Exception e)
{
}
_done = true; // setting before the call so that sendInput doesn't wait on this
sendInput(_initCmd);
}
}
private DataElement _status; private DataElement _status;
private String _invocation; private String _invocation;
@ -93,6 +122,8 @@ public class CommandMinerThread extends MinerThread
private String PSEUDO_TERMINAL; private String PSEUDO_TERMINAL;
private DataElement _lastPrompt; private DataElement _lastPrompt;
private InitRunnable _initRunnable;
private Thread _cdThread;
public CommandMinerThread(DataElement theElement, String invocation, DataElement status, Patterns thePatterns, CommandMiner.CommandMinerDescriptors descriptors) public CommandMinerThread(DataElement theElement, String invocation, DataElement status, Patterns thePatterns, CommandMiner.CommandMinerDescriptors descriptors)
{ {
@ -511,26 +542,9 @@ public class CommandMinerThread extends MinerThread
} }
// need to CD to the correct directory // need to CD to the correct directory
final String finitCmd = initCmd; _initRunnable = new InitRunnable(initCmd);
Thread cdThread = new Thread( _cdThread = new Thread(_initRunnable);
new Runnable() _cdThread.start();
{
public void run()
{
// wait a second so the profile can complete startup
try
{
sleep(1000);
}
catch (Exception e)
{
}
sendInput(finitCmd);
}
});
cdThread.start();
} }
else if (_isShell && !_isWindows && !_isTTY) else if (_isShell && !_isWindows && !_isTTY)
{ {
@ -627,6 +641,14 @@ public class CommandMinerThread extends MinerThread
{ {
if (!_isDone) if (!_isDone)
{ {
if (_initRunnable != null && !_initRunnable.isDone()){
try {
_cdThread.join();
}
catch (InterruptedException e){}
}
String origInput = input; String origInput = input;
input = convertSpecialCharacters(input); input = convertSpecialCharacters(input);
input.getBytes(); input.getBytes();