Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2015-01-13 19:04:38 +0000
committerRoland Grunberg2015-01-20 17:39:56 +0000
commit65f45c4e16870192967d685e206a0147e36784f3 (patch)
treeb18599e49d90034a61ab760e6f5dbcfe6326657e /profiling
parentbbd6f0cd39c60992f4d3e097c1e3b002ef2e246b (diff)
downloadorg.eclipse.linuxtools-65f45c4e16870192967d685e206a0147e36784f3.tar.gz
org.eclipse.linuxtools-65f45c4e16870192967d685e206a0147e36784f3.tar.xz
org.eclipse.linuxtools-65f45c4e16870192967d685e206a0147e36784f3.zip
Systemtap: Improve no-stap errors; allow projectless processes.
Using Systemtap IDE without stap installed causes too many error dialogs to appear. Simplify/streamline the kinds of error dialogs that are shown when stap is missing. Also allow RuntimeProcessFactory to launch processes that don't have a host project, which is required for the above error dialog improvements. Change-Id: I39daf04c28d2dab53fa46c7c6b8de64a6c3f4ae1 Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com> Reviewed-on: https://git.eclipse.org/r/39540 Tested-by: Hudson CI Reviewed-by: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
Diffstat (limited to 'profiling')
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/RuntimeProcessFactory.java89
1 files changed, 44 insertions, 45 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 a2108a002e..1a5f4a2467 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
@@ -64,7 +64,7 @@ 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
@@ -80,59 +80,58 @@ public class RuntimeProcessFactory extends LinuxtoolsProcessFactory {
* @since 1.1
*/
public String whichCommand(String command, IProject project) throws IOException {
- if (project != null) {
- String[] envp = updateEnvironment(null, project);
- try {
- IRemoteFileProxy proxy = RemoteProxyManager.getInstance().getFileProxy(project);
- 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());
- if (pProxy != null) {
-
- String errorLine;
- try (BufferedReader error = new BufferedReader(
- new InputStreamReader(pProxy.getErrorStream()))) {
- if ((errorLine = error.readLine()) != null) {
- throw new IOException(errorLine);
- }
+ String[] envp = updateEnvironment(null, project);
+ try {
+ IRemoteFileProxy proxy = RemoteProxyManager.getInstance().getFileProxy(project);
+ URI whichUri;
+ // For Windows, we use the where command, otherwise, we use the Unix which command
+ if ((project != null && Platform.OS_WIN32.equals(RemoteProxyManager.getInstance().getOS(project)))
+ || Platform.OS_WIN32.equals(Platform.getOS())) {
+ 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());
+ if (pProxy != null) {
+
+ String errorLine;
+ try (BufferedReader error = new BufferedReader(
+ new InputStreamReader(pProxy.getErrorStream()))) {
+ if ((errorLine = error.readLine()) != null) {
+ throw new IOException(errorLine);
}
- ArrayList<String> lines = new ArrayList<>();
- try (BufferedReader reader = new BufferedReader(
- new InputStreamReader(pProxy.getInputStream()))) {
- String readLine = reader.readLine();
- while (readLine != null) {
- lines.add(readLine);
- readLine = reader.readLine();
- }
+ }
+ ArrayList<String> lines = new ArrayList<>();
+ try (BufferedReader reader = new BufferedReader(
+ new InputStreamReader(pProxy.getInputStream()))) {
+ String readLine = reader.readLine();
+ while (readLine != null) {
+ lines.add(readLine);
+ readLine = reader.readLine();
}
- if (!lines.isEmpty()) {
- if (project.getLocationURI() != null) {
- if (project.getLocationURI().toString()
- .startsWith("rse:")) { //$NON-NLS-1$
- // RSE output
- if (lines.size() > 1) {
- command = lines.get(lines.size() - 2);
- }
- } else {
- // Remotetools output
- command = lines.get(0);
+ }
+ if (!lines.isEmpty()) {
+ if (project != null && project.getLocationURI() != null) {
+ if (project.getLocationURI().toString()
+ .startsWith("rse:")) { //$NON-NLS-1$
+ // RSE output
+ if (lines.size() > 1) {
+ command = lines.get(lines.size() - 2);
}
} else {
- // Local output
+ // Remotetools output
command = lines.get(0);
}
+ } else {
+ // Local output
+ command = lines.get(0);
}
}
- } catch (CoreException e) {
- // Failed to call 'which', do nothing
}
+ } catch (CoreException e) {
+ // Failed to call 'which', do nothing
}
return command;
}

Back to the top