Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2014-12-18 19:24:22 +0000
committerRoland Grunberg2015-01-05 19:46:53 +0000
commit60fc89be1dc6b0e3294dafadef912e75fb50e48a (patch)
tree8e5f5c32527baeefa6e54876609ea7bf756011a2
parent783a5b103c5e0e77d036eaa328d4986aa476ee26 (diff)
downloadorg.eclipse.linuxtools-60fc89be1dc6b0e3294dafadef912e75fb50e48a.tar.gz
org.eclipse.linuxtools-60fc89be1dc6b0e3294dafadef912e75fb50e48a.tar.xz
org.eclipse.linuxtools-60fc89be1dc6b0e3294dafadef912e75fb50e48a.zip
Fix RuntimeProcessFactory whichCommand() method
- when running on Windows use the "where" command instead of the Unix "which" command Change-Id: I7384f1700ddf873c647045ff77c1ff3e01597d8b Reviewed-on: https://git.eclipse.org/r/38516 Tested-by: Hudson CI Reviewed-by: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/RuntimeProcessFactory.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/RuntimeProcessFactory.java b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/RuntimeProcessFactory.java
index cf405f89bb..a2108a002e 100644
--- a/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/RuntimeProcessFactory.java
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/RuntimeProcessFactory.java
@@ -27,6 +27,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.linuxtools.profiling.launch.IRemoteCommandLauncher;
import org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy;
import org.eclipse.linuxtools.profiling.launch.RemoteProxyManager;
@@ -41,6 +42,7 @@ import org.eclipse.linuxtools.profiling.launch.RemoteProxyManager;
public class RuntimeProcessFactory extends LinuxtoolsProcessFactory {
private static RuntimeProcessFactory instance = null;
private static final String WHICH_CMD = "which"; //$NON-NLS-1$
+ private static final String WHERE_CMD = "where"; //$NON-NLS-1$
private String[] tokenizeCommand(String command) {
StringTokenizer tokenizer = new StringTokenizer(command);
@@ -62,7 +64,8 @@ public class RuntimeProcessFactory extends LinuxtoolsProcessFactory {
return cmdarray;
}
- /**
+
+ /**
* Used to get the full command path. It will look for the command in the
* system path and in the path selected in 'Linux Tools Path' preference page
* in the informed project.
@@ -81,7 +84,13 @@ public class RuntimeProcessFactory extends LinuxtoolsProcessFactory {
String[] envp = updateEnvironment(null, project);
try {
IRemoteFileProxy proxy = RemoteProxyManager.getInstance().getFileProxy(project);
- URI whichUri = URI.create(WHICH_CMD);
+ String platform = RemoteProxyManager.getInstance().getOS(project);
+ URI whichUri = null;
+ // For Windows, we use the where command, otherwise, we use the Unix which command
+ if (platform.equals(Platform.OS_WIN32))
+ whichUri = URI.create(WHERE_CMD);
+ else
+ whichUri = URI.create(WHICH_CMD);
IPath whichPath = new Path(proxy.toPath(whichUri));
IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(project);
Process pProxy = launcher.execute(whichPath, new String[]{command}, envp, null, new NullProgressMonitor());

Back to the top