mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 04:55:22 +02:00
[302174] [dstore] shell init command can potentially get called too late
This commit is contained in:
parent
57b4e6d029
commit
59ad1c4786
1 changed files with 43 additions and 21 deletions
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -510,27 +541,10 @@ public class CommandMinerThread extends MinerThread
|
||||||
initCmd += "cd " + _cwdStr; //$NON-NLS-1$
|
initCmd += "cd " + _cwdStr; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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();
|
||||||
|
|
Loading…
Add table
Reference in a new issue