Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Torregrosa Paez2016-04-26 10:12:11 -0400
committerPablo Torregrosa Paez2016-04-26 10:12:49 -0400
commit22f45e9b4fbc831ad5e277fde8f6064f58f13ed3 (patch)
tree8c82b4d66c0f64c55354132b3abe44d9e4b54857 /target_explorer
parenta2aa0e3edea34f9a4f8d8418ce96ebc611bcff65 (diff)
downloadorg.eclipse.tcf-22f45e9b4fbc831ad5e277fde8f6064f58f13ed3.tar.gz
org.eclipse.tcf-22f45e9b4fbc831ad5e277fde8f6064f58f13ed3.tar.xz
org.eclipse.tcf-22f45e9b4fbc831ad5e277fde8f6064f58f13ed3.zip
Target Explorer: Fix - Launch remote app omitted program arguments
Change-Id: Ief709b1393a30f9a3634ae3f0f26acbb8e753e52 Signed-off-by: Pablo Torregrosa Paez <pablo.torregrosa@windriver.com>
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TERunLaunchDelegate.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TERunLaunchDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TERunLaunchDelegate.java
index 6ffb89f89..f1e4c0610 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TERunLaunchDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TERunLaunchDelegate.java
@@ -57,6 +57,8 @@ public class TERunLaunchDelegate extends AbstractCLaunchDelegate2 {
IPeer peer = TEHelper.getCurrentConnection(config).getPeer();
// 1.1. If there are commands to run before, create a script for them
String remoteExePath = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_REMOTE_PATH, ""); //$NON-NLS-1$
+ String arguments = getProgramArguments(config);
+ String remoteLaunchCommand = remoteExePath.replaceAll("\\r", "") + " " + arguments; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IPath remotePrerunScriptPath = null;
boolean launchAsRemoteUser = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_LAUNCH_REMOTE_USER, false);
String userId = config.getAttribute(IRemoteTEConfigurationConstants.ATTR_REMOTE_USER_ID, (String)null);
@@ -76,7 +78,7 @@ public class TERunLaunchDelegate extends AbstractCLaunchDelegate2 {
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(prerunScriptLocation.toFile()));
- writer.write(NLS.bind(TEHelper.getPrerunTemplateContent(peer), prerunCommands.replaceAll("\\r", ""), remoteExePath.replaceAll("\\r", ""))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ writer.write(NLS.bind(TEHelper.getPrerunTemplateContent(peer), prerunCommands.replaceAll("\\r", ""), remoteLaunchCommand)); //$NON-NLS-1$ //$NON-NLS-2$
} catch (Exception e) {
abort(NLS.bind(Messages.TEGdbAbstractLaunchDelegate_prerunScriptCreationFailed, prerunScriptLocation.toString(), e.getLocalizedMessage()), e, ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
} finally {
@@ -115,16 +117,18 @@ public class TERunLaunchDelegate extends AbstractCLaunchDelegate2 {
// 2. Run the binary
monitor.setTaskName(Messages.TEGdbAbstractLaunchDelegate_starting_debugger);
- String arguments = getProgramArguments(config);
- // Pass the user id as an argument to the script
- if (launchAsRemoteUser && userId != null && userId.trim().length() > 0) {
- arguments = "-u__ " + userId + " " + (arguments != null ? arguments : ""); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- }
+
Map<String,String> env = config.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map<String,String>)null);
if (remotePrerunScriptPath != null) {
- remoteExePath = remotePrerunScriptPath.toString();
+ // Pass the user id as an argument to the script
+ String launchArguments = ""; //$NON-NLS-1$
+ if (launchAsRemoteUser && userId != null && userId.trim().length() > 0) {
+ launchArguments = "-u__ " + userId; //$NON-NLS-1$
+ }
+ new TERunProcess(launch, remotePrerunScriptPath.toString(), launchArguments, env, renderProcessLabel(exePath.toString()), peer, new SubProgressMonitor(monitor, 20));
+ } else {
+ new TERunProcess(launch, remoteExePath, arguments, env, renderProcessLabel(exePath.toString()), peer, new SubProgressMonitor(monitor, 20));
}
- new TERunProcess(launch, remoteExePath, arguments, env, renderProcessLabel(exePath.toString()), peer, new SubProgressMonitor(monitor, 20));
}
}

Back to the top