Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354096 - RemoteTools keeps executing command list when commands fail
Summary: RemoteTools keeps executing command list when commands fail
Status: CLOSED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: Remote Tools (show other bugs)
Version: 5.0.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Roland Schulz CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-07 15:30 EDT by Roland Schulz CLA
Modified: 2012-06-23 17:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Schulz CLA 2011-08-07 15:30:52 EDT
org.eclipse.ptp.remotetools.internal.common.RemoteScript.getScriptString() combines the individual commands set by org.eclipse.ptp.remotetools.internal.common.RemoteScript.setScript(String[]) with a ";". Thus all commands in the list are executed even if the first one fails. By far the most common use of executing a list of commands is that the first command is "cd $workingdir". If this fails the subsequent command is executed in the wrong working directory which can have unintended consequences. 

The only other usage of setScript(String[]) is for org.eclipse.ptp.remotetools.environment.launcher.internal.RemoteLaunchProcess.runApplication(). But even in that case I assume one would not want to run subsequent commands if an earlier failed.

Thus, I suggest to replace ";" with "&&" in getScriptString.

I tested that "&&" is supported in dash, bash, csh, tcsh, and zsh.
Comment 1 Greg Watson CLA 2011-08-07 16:23:13 EDT
What about ksh?
Comment 2 Roland Schulz CLA 2011-08-07 16:50:15 EDT
(In reply to comment #1)
> What about ksh?

works too
Comment 3 Roland Schulz CLA 2011-08-16 18:40:55 EDT
should I commit this change or does this need more discussion/testing?
Comment 4 Greg Watson CLA 2011-08-16 22:28:28 EDT
It definitely needs testing. Please commit and I'll do some basic testing with RDT and RMs.
Comment 5 Roland Schulz CLA 2011-08-16 22:33:46 EDT
committed