mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-09 18:15:23 +02:00
[cleanup] fix NON-NLS-1 tags
This commit is contained in:
parent
4f47e316c7
commit
1468c657d8
4 changed files with 101 additions and 104 deletions
|
@ -90,7 +90,7 @@ public class ServerLauncher extends Thread {
|
||||||
_reader = new BufferedReader(new InputStreamReader(_socket
|
_reader = new BufferedReader(new InputStreamReader(_socket
|
||||||
.getInputStream(), DE.ENCODING_UTF_8));
|
.getInputStream(), DE.ENCODING_UTF_8));
|
||||||
} catch (java.io.IOException e) {
|
} catch (java.io.IOException e) {
|
||||||
System.out.println("ServerLauncher:" + e);
|
System.out.println("ServerLauncher:" + e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,11 +135,11 @@ public class ServerLauncher extends Thread {
|
||||||
|
|
||||||
_serverProcess.waitFor();
|
_serverProcess.waitFor();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("ServerLauncher:" + e);
|
System.out.println("ServerLauncher:" + e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("finished on port " + _port);
|
System.out.println("finished on port " + _port); //$NON-NLS-1$
|
||||||
_outReader = null;
|
_outReader = null;
|
||||||
_errReader = null;
|
_errReader = null;
|
||||||
_serverProcess = null;
|
_serverProcess = null;
|
||||||
|
@ -169,7 +169,7 @@ public class ServerLauncher extends Thread {
|
||||||
|
|
||||||
private boolean isPortInRange(String portStr, String portRange) {
|
private boolean isPortInRange(String portStr, String portRange) {
|
||||||
if (portRange != null) {
|
if (portRange != null) {
|
||||||
String[] range = portRange.split("-");
|
String[] range = portRange.split("-"); //$NON-NLS-1$
|
||||||
if (range.length == 2) {
|
if (range.length == 2) {
|
||||||
int lPort = 0;
|
int lPort = 0;
|
||||||
int hPort = 0;
|
int hPort = 0;
|
||||||
|
@ -211,12 +211,12 @@ public class ServerLauncher extends Thread {
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
_port = "0";
|
_port = "0"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (_serverPortRange != null && (_port == null || _port.equals("0")))
|
if (_serverPortRange != null && (_port == null || _port.equals("0"))) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
_port = _serverPortRange;
|
_port = _serverPortRange;
|
||||||
}
|
}
|
||||||
|
@ -239,13 +239,13 @@ public class ServerLauncher extends Thread {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String launchStatus = null;
|
String launchStatus = null;
|
||||||
String ticket = new String("" + System.currentTimeMillis());
|
String ticket = new String("" + System.currentTimeMillis()); //$NON-NLS-1$
|
||||||
|
|
||||||
String theOS = System.getProperty("os.name");
|
String theOS = System.getProperty("os.name"); //$NON-NLS-1$
|
||||||
String timeout = "120000";
|
String timeout = "120000"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
if (!theOS.toLowerCase().startsWith("win"))
|
if (!theOS.toLowerCase().startsWith("win")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
// assuming unix compatable
|
// assuming unix compatable
|
||||||
//
|
//
|
||||||
|
@ -253,7 +253,7 @@ public class ServerLauncher extends Thread {
|
||||||
// contains the authorization
|
// contains the authorization
|
||||||
// script path
|
// script path
|
||||||
//
|
//
|
||||||
String authPath = System.getProperty("RSE.AUTH");
|
String authPath = System.getProperty("RSE.AUTH"); //$NON-NLS-1$
|
||||||
File authFile = null;
|
File authFile = null;
|
||||||
if (authPath != null && authPath.length() > 0)
|
if (authPath != null && authPath.length() > 0)
|
||||||
{
|
{
|
||||||
|
@ -261,26 +261,26 @@ public class ServerLauncher extends Thread {
|
||||||
}
|
}
|
||||||
if (authFile == null || !authFile.exists())
|
if (authFile == null || !authFile.exists())
|
||||||
{
|
{
|
||||||
authPath = "perl " + _path + File.separator + "auth.pl";
|
authPath = "perl " + _path + File.separator + "auth.pl"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
String authString =
|
String authString =
|
||||||
authPath
|
authPath
|
||||||
+ " "
|
+ " " //$NON-NLS-1$
|
||||||
+ user
|
+ user
|
||||||
+ " "
|
+ " " //$NON-NLS-1$
|
||||||
+ _path
|
+ _path
|
||||||
+ " "
|
+ " " //$NON-NLS-1$
|
||||||
+ _port
|
+ _port
|
||||||
+ " "
|
+ " " //$NON-NLS-1$
|
||||||
+ timeout
|
+ timeout
|
||||||
+ " "
|
+ " " //$NON-NLS-1$
|
||||||
+ ticket
|
+ ticket
|
||||||
+ " " //$NON-NLS-1$
|
+ " " //$NON-NLS-1$
|
||||||
+ System.getProperty("java.home"); //$NON-NLS-1$
|
+ System.getProperty("java.home") //$NON-NLS-1$
|
||||||
;
|
;
|
||||||
|
|
||||||
String[] authArray = { "sh", "-c", authString };
|
String[] authArray = { "sh", "-c", authString }; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
// test password
|
// test password
|
||||||
_serverProcess = Runtime.getRuntime().exec(authArray);
|
_serverProcess = Runtime.getRuntime().exec(authArray);
|
||||||
|
@ -301,9 +301,9 @@ public class ServerLauncher extends Thread {
|
||||||
// launch new server
|
// launch new server
|
||||||
String[] cmdArray =
|
String[] cmdArray =
|
||||||
{
|
{
|
||||||
"java",
|
"java", //$NON-NLS-1$
|
||||||
"-DA_PLUGIN_PATH=" + _path,
|
"-DA_PLUGIN_PATH=" + _path, //$NON-NLS-1$
|
||||||
"org.eclipse.dstore.core.server.Server",
|
"org.eclipse.dstore.core.server.Server", //$NON-NLS-1$
|
||||||
_port,
|
_port,
|
||||||
timeout,
|
timeout,
|
||||||
ticket};
|
ticket};
|
||||||
|
@ -312,10 +312,10 @@ public class ServerLauncher extends Thread {
|
||||||
_outReader = new BufferedReader(new InputStreamReader(_serverProcess.getInputStream()));
|
_outReader = new BufferedReader(new InputStreamReader(_serverProcess.getInputStream()));
|
||||||
_errReader = new BufferedReader(new InputStreamReader(_serverProcess.getErrorStream()));
|
_errReader = new BufferedReader(new InputStreamReader(_serverProcess.getErrorStream()));
|
||||||
|
|
||||||
launchStatus = "success";
|
launchStatus = "success"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((launchStatus == null) || !launchStatus.equals("success"))
|
if ((launchStatus == null) || !launchStatus.equals("success")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
_writer.println(IDataStoreConstants.AUTHENTICATION_FAILED);
|
_writer.println(IDataStoreConstants.AUTHENTICATION_FAILED);
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ public class ServerLauncher extends Thread {
|
||||||
_writer.println(_port);
|
_writer.println(_port);
|
||||||
_writer.println(ticket);
|
_writer.println(ticket);
|
||||||
|
|
||||||
System.out.println("launched new server on " + _port);
|
System.out.println("launched new server on " + _port); //$NON-NLS-1$
|
||||||
connected = true;
|
connected = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -381,14 +381,14 @@ public class ServerLauncher extends Thread {
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
System.out.println("ServerLauncher:" + e);
|
System.out.println("ServerLauncher:" + e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return connected;
|
return connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handshakeCompleted(HandshakeCompletedEvent event) {
|
public void handshakeCompleted(HandshakeCompletedEvent event) {
|
||||||
System.out.println("handshake completed");
|
System.out.println("handshake completed"); //$NON-NLS-1$
|
||||||
System.out.println(event);
|
System.out.println(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -410,9 +410,9 @@ public class ServerLauncher extends Thread {
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public ServerLauncher() {
|
public ServerLauncher() {
|
||||||
String pluginPath = System.getProperty("A_PLUGIN_PATH");
|
String pluginPath = System.getProperty("A_PLUGIN_PATH"); //$NON-NLS-1$
|
||||||
if (pluginPath == null) {
|
if (pluginPath == null) {
|
||||||
System.out.println("A_PLUGIN_PATH is not defined");
|
System.out.println("A_PLUGIN_PATH is not defined"); //$NON-NLS-1$
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ public class ServerLauncher extends Thread {
|
||||||
|
|
||||||
_connections = new ArrayList();
|
_connections = new ArrayList();
|
||||||
|
|
||||||
init(DEFAULT_DAEMON_PORT + "");
|
init(DEFAULT_DAEMON_PORT + ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -430,9 +430,9 @@ public class ServerLauncher extends Thread {
|
||||||
* the port for the daemon socket to run on
|
* the port for the daemon socket to run on
|
||||||
*/
|
*/
|
||||||
public ServerLauncher(String portStr) {
|
public ServerLauncher(String portStr) {
|
||||||
String pluginPath = System.getProperty("A_PLUGIN_PATH");
|
String pluginPath = System.getProperty("A_PLUGIN_PATH"); //$NON-NLS-1$
|
||||||
if (pluginPath == null) {
|
if (pluginPath == null) {
|
||||||
System.out.println("A_PLUGIN_PATH is not defined");
|
System.out.println("A_PLUGIN_PATH is not defined"); //$NON-NLS-1$
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,9 +451,9 @@ public class ServerLauncher extends Thread {
|
||||||
* the port range for launched servers
|
* the port range for launched servers
|
||||||
*/
|
*/
|
||||||
public ServerLauncher(String portStr, String serverPortRange) {
|
public ServerLauncher(String portStr, String serverPortRange) {
|
||||||
String pluginPath = System.getProperty("A_PLUGIN_PATH");
|
String pluginPath = System.getProperty("A_PLUGIN_PATH"); //$NON-NLS-1$
|
||||||
if (pluginPath == null) {
|
if (pluginPath == null) {
|
||||||
System.out.println("A_PLUGIN_PATH is not defined");
|
System.out.println("A_PLUGIN_PATH is not defined"); //$NON-NLS-1$
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,15 +475,14 @@ public class ServerLauncher extends Thread {
|
||||||
/**
|
/**
|
||||||
* initializes the DataStore daemon
|
* initializes the DataStore daemon
|
||||||
*
|
*
|
||||||
* @param port
|
* @param portStr the daemon port
|
||||||
* the daemon port
|
|
||||||
*/
|
*/
|
||||||
public void init(String portStr) {
|
public void init(String portStr) {
|
||||||
// create server socket from port
|
// create server socket from port
|
||||||
_sslProperties = new ServerSSLProperties();
|
_sslProperties = new ServerSSLProperties();
|
||||||
|
|
||||||
// determine if portStr is a port range or just a port
|
// determine if portStr is a port range or just a port
|
||||||
String[] range = portStr.split("-");
|
String[] range = portStr.split("-"); //$NON-NLS-1$
|
||||||
if (range.length == 2) {
|
if (range.length == 2) {
|
||||||
int lPort = 0;
|
int lPort = 0;
|
||||||
int hPort = 0;
|
int hPort = 0;
|
||||||
|
@ -517,9 +516,9 @@ public class ServerLauncher extends Thread {
|
||||||
if (_serverSocket != null
|
if (_serverSocket != null
|
||||||
&& _serverSocket.getLocalPort() > 0) {
|
&& _serverSocket.getLocalPort() > 0) {
|
||||||
socketBound = true;
|
socketBound = true;
|
||||||
System.out.println("Daemon running on: "
|
System.out.println("Daemon running on: " //$NON-NLS-1$
|
||||||
+ InetAddress.getLocalHost().getHostName()
|
+ InetAddress.getLocalHost().getHostName()
|
||||||
+ ", port: " + i);
|
+ ", port: " + i); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
System.err
|
System.err
|
||||||
|
@ -527,7 +526,7 @@ public class ServerLauncher extends Thread {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
} catch (BindException e) {
|
} catch (BindException e) {
|
||||||
System.err.println("socket taken on " + i);
|
System.err.println("socket taken on " + i); //$NON-NLS-1$
|
||||||
// keep going
|
// keep going
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Failure to create ServerSocket");
|
System.err.println("Failure to create ServerSocket");
|
||||||
|
@ -556,8 +555,8 @@ public class ServerLauncher extends Thread {
|
||||||
} else {
|
} else {
|
||||||
_serverSocket = new ServerSocket(port);
|
_serverSocket = new ServerSocket(port);
|
||||||
}
|
}
|
||||||
System.out.println("Daemon running on: "
|
System.out.println("Daemon running on: " //$NON-NLS-1$
|
||||||
+ InetAddress.getLocalHost().getHostName() + ", port: "
|
+ InetAddress.getLocalHost().getHostName() + ", port: " //$NON-NLS-1$
|
||||||
+ port);
|
+ port);
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
System.err
|
System.err
|
||||||
|
@ -607,13 +606,13 @@ public class ServerLauncher extends Thread {
|
||||||
|
|
||||||
public void handshakeCompleted(
|
public void handshakeCompleted(
|
||||||
HandshakeCompletedEvent event) {
|
HandshakeCompletedEvent event) {
|
||||||
System.out.println("handshake completed");
|
System.out.println("handshake completed"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
SSLSession session = sslSocket.getSession();
|
SSLSession session = sslSocket.getSession();
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
System.out.println("handshake failed");
|
System.out.println("handshake failed"); //$NON-NLS-1$
|
||||||
|
|
||||||
sslSocket.close();
|
sslSocket.close();
|
||||||
connectionOkay = false;
|
connectionOkay = false;
|
||||||
|
|
|
@ -56,17 +56,17 @@ public class ProcessTracker extends Handler
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
String result = getPID() + " " + getCMD();
|
String result = getPID() + " " + getCMD(); //$NON-NLS-1$
|
||||||
if (ProcessDescriptor.this == _newestProcess)
|
if (ProcessDescriptor.this == _newestProcess)
|
||||||
{
|
{
|
||||||
result += " *";
|
result += " *"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasCMD(String cmdname)
|
public boolean hasCMD(String cmdname)
|
||||||
{
|
{
|
||||||
StringTokenizer tokenizer = new StringTokenizer(_cmd, "/");
|
StringTokenizer tokenizer = new StringTokenizer(_cmd, "/"); //$NON-NLS-1$
|
||||||
|
|
||||||
while (tokenizer.hasMoreTokens())
|
while (tokenizer.hasMoreTokens())
|
||||||
{
|
{
|
||||||
|
@ -117,28 +117,28 @@ public class ProcessTracker extends Handler
|
||||||
|
|
||||||
private String getFormatOptions(String theOS)
|
private String getFormatOptions(String theOS)
|
||||||
{
|
{
|
||||||
String formatOptions = "";
|
String formatOptions = ""; //$NON-NLS-1$
|
||||||
if (theOS.startsWith("z"))
|
if (theOS.startsWith("z")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
formatOptions = "-o pid,comm";
|
formatOptions = "-o pid,comm"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else if (theOS.startsWith("linux"))
|
else if (theOS.startsWith("linux")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
formatOptions = "--format pid,ucomm";
|
formatOptions = "--format pid,ucomm"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else if (theOS.startsWith("aix"))
|
else if (theOS.startsWith("aix")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
formatOptions = "-F pid,ucomm";
|
formatOptions = "-F pid,ucomm"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return formatOptions;
|
return formatOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
String userID = System.getProperty("user.name");
|
String userID = System.getProperty("user.name"); //$NON-NLS-1$
|
||||||
String userOptions = "-u " + userID;
|
String userOptions = "-u " + userID; //$NON-NLS-1$
|
||||||
|
|
||||||
String theOS = System.getProperty("os.name").toLowerCase();
|
String theOS = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
|
||||||
String formatOptions = getFormatOptions(theOS);
|
String formatOptions = getFormatOptions(theOS);
|
||||||
if (formatOptions.length() == 0)
|
if (formatOptions.length() == 0)
|
||||||
{
|
{
|
||||||
|
@ -151,15 +151,15 @@ public class ProcessTracker extends Handler
|
||||||
if (_isEnabled)
|
if (_isEnabled)
|
||||||
{
|
{
|
||||||
|
|
||||||
_psCommand = "ps " + userOptions + " " + formatOptions;
|
_psCommand = "ps " + userOptions + " " + formatOptions; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_psShell == null)
|
if (_psShell == null)
|
||||||
{
|
{
|
||||||
_psShell = Runtime.getRuntime().exec("sh");
|
_psShell = Runtime.getRuntime().exec("sh"); //$NON-NLS-1$
|
||||||
|
|
||||||
String specialEncoding = System.getProperty("dstore.stdin.encoding");
|
String specialEncoding = System.getProperty("dstore.stdin.encoding"); //$NON-NLS-1$
|
||||||
if (specialEncoding != null)
|
if (specialEncoding != null)
|
||||||
{
|
{
|
||||||
_psReader = new BufferedReader(new InputStreamReader(_psShell.getInputStream(), specialEncoding));
|
_psReader = new BufferedReader(new InputStreamReader(_psShell.getInputStream(), specialEncoding));
|
||||||
|
@ -255,7 +255,7 @@ public class ProcessTracker extends Handler
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_psWriter.write(_psCommand);
|
_psWriter.write(_psCommand);
|
||||||
_psWriter.write("\n");
|
_psWriter.write("\n"); //$NON-NLS-1$
|
||||||
_psWriter.flush();
|
_psWriter.flush();
|
||||||
|
|
||||||
// skip first line
|
// skip first line
|
||||||
|
@ -271,7 +271,7 @@ public class ProcessTracker extends Handler
|
||||||
String pid = line.substring(0, firstBlank);
|
String pid = line.substring(0, firstBlank);
|
||||||
String cmd = line.substring(firstBlank + 1, line.length());
|
String cmd = line.substring(firstBlank + 1, line.length());
|
||||||
ProcessDescriptor descriptor = new ProcessDescriptor(pid, cmd);
|
ProcessDescriptor descriptor = new ProcessDescriptor(pid, cmd);
|
||||||
if (!descriptor.hasCMD("ps"))
|
if (!descriptor.hasCMD("ps")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
newPIDs.add(descriptor);
|
newPIDs.add(descriptor);
|
||||||
}
|
}
|
||||||
|
@ -333,8 +333,8 @@ public class ProcessTracker extends Handler
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_psWriter.write("exit");
|
_psWriter.write("exit"); //$NON-NLS-1$
|
||||||
_psWriter.write("\n");
|
_psWriter.write("\n"); //$NON-NLS-1$
|
||||||
_psWriter.flush();
|
_psWriter.flush();
|
||||||
|
|
||||||
_psReader.close();
|
_psReader.close();
|
||||||
|
@ -392,8 +392,8 @@ public class ProcessTracker extends Handler
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_psWriter.write("kill " + descriptor.getPID());
|
_psWriter.write("kill " + descriptor.getPID()); //$NON-NLS-1$
|
||||||
_psWriter.write("\n");
|
_psWriter.write("\n"); //$NON-NLS-1$
|
||||||
_psWriter.flush();
|
_psWriter.flush();
|
||||||
_psReader.reset();
|
_psReader.reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,11 +60,9 @@ public class LocalShellThread extends Thread
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* consturtor for local command shell monitor
|
* consturtor for local command shell monitor
|
||||||
* @param fileSubSystem associated local file subsystem
|
|
||||||
* @param cwd initial working directory
|
* @param cwd initial working directory
|
||||||
* @param invocation launch shell command
|
* @param invocation launch shell command
|
||||||
* @param encoding
|
* @param encoding
|
||||||
* @param patterns patterns file for output interpretation
|
|
||||||
* @param envVars user and system environment variables to launch shell with
|
* @param envVars user and system environment variables to launch shell with
|
||||||
*/
|
*/
|
||||||
public LocalShellThread(String cwd, String invocation, String encoding, String[] envVars)
|
public LocalShellThread(String cwd, String invocation, String encoding, String[] envVars)
|
||||||
|
@ -79,7 +77,7 @@ public class LocalShellThread extends Thread
|
||||||
// then the rse.pty property will have been set
|
// then the rse.pty property will have been set
|
||||||
// by the contributor of the pty exectuable
|
// by the contributor of the pty exectuable
|
||||||
// on linux client this is a likely scenario
|
// on linux client this is a likely scenario
|
||||||
PSEUDO_TERMINAL = System.getProperty("rse.pty");
|
PSEUDO_TERMINAL = System.getProperty("rse.pty"); //$NON-NLS-1$
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PSEUDO_TERMINAL = Platform.resolve(new URL(PSEUDO_TERMINAL)).getPath();
|
PSEUDO_TERMINAL = Platform.resolve(new URL(PSEUDO_TERMINAL)).getPath();
|
||||||
|
@ -130,8 +128,8 @@ public class LocalShellThread extends Thread
|
||||||
File theDirectory = new File(_cwd);
|
File theDirectory = new File(_cwd);
|
||||||
if (!theDirectory.isDirectory())
|
if (!theDirectory.isDirectory())
|
||||||
theDirectory = theDirectory.getParentFile();
|
theDirectory = theDirectory.getParentFile();
|
||||||
String theOS = System.getProperty("os.name");
|
String theOS = System.getProperty("os.name"); //$NON-NLS-1$
|
||||||
_isWindows = theOS.toLowerCase().startsWith("win");
|
_isWindows = theOS.toLowerCase().startsWith("win"); //$NON-NLS-1$
|
||||||
_isTTY = PSEUDO_TERMINAL != null && (new File(PSEUDO_TERMINAL).exists());
|
_isTTY = PSEUDO_TERMINAL != null && (new File(PSEUDO_TERMINAL).exists());
|
||||||
|
|
||||||
String theShell = null;
|
String theShell = null;
|
||||||
|
@ -142,7 +140,7 @@ public class LocalShellThread extends Thread
|
||||||
if (theShell == null)
|
if (theShell == null)
|
||||||
{
|
{
|
||||||
|
|
||||||
String property = "SHELL=";
|
String property = "SHELL="; //$NON-NLS-1$
|
||||||
|
|
||||||
for (int i = 0; i < envVars.length; i++)
|
for (int i = 0; i < envVars.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -151,9 +149,9 @@ public class LocalShellThread extends Thread
|
||||||
{
|
{
|
||||||
theShell = var.substring(property.length(), var.length());
|
theShell = var.substring(property.length(), var.length());
|
||||||
|
|
||||||
if (theShell.endsWith("bash"))
|
if (theShell.endsWith("bash")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
theShell = "sh";
|
theShell = "sh"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -161,13 +159,13 @@ public class LocalShellThread extends Thread
|
||||||
|
|
||||||
if (theShell == null)
|
if (theShell == null)
|
||||||
{
|
{
|
||||||
theShell = "sh";
|
theShell = "sh"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_isTTY)
|
if (_isTTY)
|
||||||
{
|
{
|
||||||
if (_invocation.equals(">"))
|
if (_invocation.equals(">")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
_invocation = theShell;
|
_invocation = theShell;
|
||||||
_isShell = true;
|
_isShell = true;
|
||||||
|
@ -181,7 +179,7 @@ public class LocalShellThread extends Thread
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_invocation.equals(">"))
|
if (_invocation.equals(">")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
_invocation = theShell;
|
_invocation = theShell;
|
||||||
_isShell = true;
|
_isShell = true;
|
||||||
|
@ -197,7 +195,7 @@ public class LocalShellThread extends Thread
|
||||||
{
|
{
|
||||||
if (_isTTY)
|
if (_isTTY)
|
||||||
{
|
{
|
||||||
if (_invocation.equals(">"))
|
if (_invocation.equals(">")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
_invocation = theShell;
|
_invocation = theShell;
|
||||||
_isShell = true;
|
_isShell = true;
|
||||||
|
@ -206,14 +204,14 @@ public class LocalShellThread extends Thread
|
||||||
String args[] = new String[4];
|
String args[] = new String[4];
|
||||||
args[0] = PSEUDO_TERMINAL;
|
args[0] = PSEUDO_TERMINAL;
|
||||||
args[1] = theShell;
|
args[1] = theShell;
|
||||||
args[2] = "-c";
|
args[2] = "-c"; //$NON-NLS-1$
|
||||||
args[3] = _invocation;
|
args[3] = _invocation;
|
||||||
|
|
||||||
_theProcess = Runtime.getRuntime().exec(args, envVars, theDirectory);
|
_theProcess = Runtime.getRuntime().exec(args, envVars, theDirectory);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_invocation.equals(">"))
|
if (_invocation.equals(">")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
_invocation = theShell;
|
_invocation = theShell;
|
||||||
_isShell = true;
|
_isShell = true;
|
||||||
|
@ -221,7 +219,7 @@ public class LocalShellThread extends Thread
|
||||||
|
|
||||||
String args[] = new String[3];
|
String args[] = new String[3];
|
||||||
args[0] = theShell;
|
args[0] = theShell;
|
||||||
args[1] = "-c";
|
args[1] = "-c"; //$NON-NLS-1$
|
||||||
args[2] = _invocation;
|
args[2] = _invocation;
|
||||||
|
|
||||||
_theProcess = Runtime.getRuntime().exec(args, envVars, theDirectory);
|
_theProcess = Runtime.getRuntime().exec(args, envVars, theDirectory);
|
||||||
|
@ -232,28 +230,28 @@ public class LocalShellThread extends Thread
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String[] envVars = getEnvironmentVariables(true);
|
String[] envVars = getEnvironmentVariables(true);
|
||||||
if ((theOS.indexOf("95") >= 0) || (theOS.indexOf("98") >= 0) || (theOS.indexOf("ME") >= 0))
|
if ((theOS.indexOf("95") >= 0) || (theOS.indexOf("98") >= 0) || (theOS.indexOf("ME") >= 0)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
{
|
{
|
||||||
theShell = "start";
|
theShell = "start"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theShell = "cmd";
|
theShell = "cmd"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_invocation.equals(">"))
|
if (_invocation.equals(">")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
_invocation = theShell;
|
_invocation = theShell;
|
||||||
_isShell = true;
|
_isShell = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theShell.equals("start"))
|
if (theShell.equals("start")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
theShell += " /B ";
|
theShell += " /B "; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theShell += " /C ";
|
theShell += " /C "; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
_theProcess = Runtime.getRuntime().exec(theShell + _invocation, envVars, theDirectory);
|
_theProcess = Runtime.getRuntime().exec(theShell + _invocation, envVars, theDirectory);
|
||||||
|
@ -277,7 +275,7 @@ public class LocalShellThread extends Thread
|
||||||
{
|
{
|
||||||
if (_encoding == null || _encoding.length() == 0)
|
if (_encoding == null || _encoding.length() == 0)
|
||||||
{
|
{
|
||||||
_encoding = System.getProperty("file.encoding");
|
_encoding = System.getProperty("file.encoding"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,7 +307,7 @@ public class LocalShellThread extends Thread
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writer.write("echo $PWD'>'");
|
writer.write("echo $PWD'>'"); //$NON-NLS-1$
|
||||||
writer.write('\n');
|
writer.write('\n');
|
||||||
writer.flush();
|
writer.flush();
|
||||||
}
|
}
|
||||||
|
@ -455,7 +453,7 @@ public class LocalShellThread extends Thread
|
||||||
{
|
{
|
||||||
if (_isShell)
|
if (_isShell)
|
||||||
{
|
{
|
||||||
sendInput("exit");
|
sendInput("exit"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
_isDone = true;
|
_isDone = true;
|
||||||
|
@ -504,7 +502,7 @@ public class LocalShellThread extends Thread
|
||||||
for (int i = 0; i < vars.length; i++)
|
for (int i = 0; i < vars.length; i++)
|
||||||
{
|
{
|
||||||
String var = vars[i].toUpperCase();
|
String var = vars[i].toUpperCase();
|
||||||
if (var.startsWith("PATH="))
|
if (var.startsWith("PATH=")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +526,7 @@ public class LocalShellThread extends Thread
|
||||||
String[] newEnv = new String[_envVars.length + 1];
|
String[] newEnv = new String[_envVars.length + 1];
|
||||||
for (int i = 0; i < _envVars.length; i++)
|
for (int i = 0; i < _envVars.length; i++)
|
||||||
newEnv[i] = _envVars[i];
|
newEnv[i] = _envVars[i];
|
||||||
newEnv[_envVars.length] = "PS1=$PWD/>";
|
newEnv[_envVars.length] = "PS1=$PWD/>"; //$NON-NLS-1$
|
||||||
_envVars = newEnv;
|
_envVars = newEnv;
|
||||||
}
|
}
|
||||||
return _envVars;
|
return _envVars;
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.eclipse.rse.services.shells.IShellService;
|
||||||
|
|
||||||
public class LocalShellService implements IShellService, ILocalService
|
public class LocalShellService implements IShellService, ILocalService
|
||||||
{
|
{
|
||||||
private static final String SHELL_INVOCATION = ">";
|
private static final String SHELL_INVOCATION = ">"; //$NON-NLS-1$
|
||||||
private String[] _envVars;
|
private String[] _envVars;
|
||||||
|
|
||||||
public LocalShellService()
|
public LocalShellService()
|
||||||
|
@ -50,7 +50,7 @@ public class LocalShellService implements IShellService, ILocalService
|
||||||
|
|
||||||
public IHostShell launchShell(IProgressMonitor monitor, String initialWorkingDirectory, String[] environment)
|
public IHostShell launchShell(IProgressMonitor monitor, String initialWorkingDirectory, String[] environment)
|
||||||
{
|
{
|
||||||
String defaultEncoding = System.getProperty("file.encoding");
|
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
|
||||||
return launchShell(monitor, initialWorkingDirectory, defaultEncoding, environment);
|
return launchShell(monitor, initialWorkingDirectory, defaultEncoding, environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class LocalShellService implements IShellService, ILocalService
|
||||||
|
|
||||||
public IHostShell runCommand(IProgressMonitor monitor, String initialWorkingDirectory, String command, String[] environment)
|
public IHostShell runCommand(IProgressMonitor monitor, String initialWorkingDirectory, String command, String[] environment)
|
||||||
{
|
{
|
||||||
String defaultEncoding = System.getProperty("file.encoding");
|
String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
|
||||||
return runCommand(monitor, initialWorkingDirectory, command, defaultEncoding, environment);
|
return runCommand(monitor, initialWorkingDirectory, command, defaultEncoding, environment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,17 +82,17 @@ public class LocalShellService implements IShellService, ILocalService
|
||||||
|
|
||||||
String[] envCommand = new String[3];
|
String[] envCommand = new String[3];
|
||||||
//If we're on windows, change the envCommand.
|
//If we're on windows, change the envCommand.
|
||||||
if (System.getProperty("os.name").toLowerCase().startsWith("win"))
|
if (System.getProperty("os.name").toLowerCase().startsWith("win")) //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
{
|
{
|
||||||
envCommand[0] = "cmd";
|
envCommand[0] = "cmd"; //$NON-NLS-1$
|
||||||
envCommand[1] = "/c";
|
envCommand[1] = "/c"; //$NON-NLS-1$
|
||||||
envCommand[2] = "set";
|
envCommand[2] = "set"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
envCommand[0] = "sh";
|
envCommand[0] = "sh"; //$NON-NLS-1$
|
||||||
envCommand[1] = "-c";
|
envCommand[1] = "-c"; //$NON-NLS-1$
|
||||||
envCommand[2] = "env";
|
envCommand[2] = "env"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
|
@ -106,7 +106,7 @@ public class LocalShellService implements IShellService, ILocalService
|
||||||
String curLine = null;
|
String curLine = null;
|
||||||
while ((curLine = reader.readLine()) != null)
|
while ((curLine = reader.readLine()) != null)
|
||||||
{
|
{
|
||||||
if (curLine.indexOf("=") > 0)
|
if (curLine.indexOf("=") > 0) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
envVars.add(curLine);
|
envVars.add(curLine);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue