Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354096

Summary: RemoteTools keeps executing command list when commands fail
Product: [Tools] PTP Reporter: Roland Schulz <roland>
Component: Remote ToolsAssignee: Roland Schulz <roland>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: g.watson
Version: 5.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

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