Skip to main content
summaryrefslogtreecommitdiffstats
path: root/cross
diff options
context:
space:
mode:
authorSimon Marchi2017-02-03 16:50:36 -0500
committerMarc Khouzam2017-03-15 16:24:37 -0400
commit4802bf3e16ee4608d0d007e9e4a460cd0cd63769 (patch)
treed3cc72e2763679221597e49d9006a55eaaf35965 /cross
parent0d62978ce7ab51484d3d0ffb8e1b81a52cc575f2 (diff)
downloadorg.eclipse.cdt-4802bf3e16ee4608d0d007e9e4a460cd0cd63769.tar.gz
org.eclipse.cdt-4802bf3e16ee4608d0d007e9e4a460cd0cd63769.tar.xz
org.eclipse.cdt-4802bf3e16ee4608d0d007e9e4a460cd0cd63769.zip
Remote debug: Use the IFileStore interface to force the file executable
Instead of calling "chmod +x" by hand, use IFileStore.putInfo to set the file attributes. Since we already use the IFileStore API to copy the file, it makes sense (and it's cleaner) to use it to set the executable attribute as well. In most cases, it wouldn't be needed to make the file executable, since it should already be on the host filesystem and IFileStore.copy transfers the attributes. However, it's still good to force it executable in case it's not already for some reason. Change-Id: I4c86e36265962781d4541aaceeb40b502248f674 Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Diffstat (limited to 'cross')
-rw-r--r--cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java35
1 files changed, 10 insertions, 25 deletions
diff --git a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java
index 7b991d0741..1bd29ea39e 100644
--- a/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java
+++ b/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java
@@ -18,12 +18,12 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.TimeUnit;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.internal.launch.remote.Activator;
import org.eclipse.cdt.internal.launch.remote.Messages;
import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.runtime.CoreException;
@@ -115,32 +115,17 @@ public class RemoteHelper {
return;
}
+ /* Copy the file to the remote file system. */
localFile.copy(remoteFile, EFS.OVERWRITE, subMonitor.split(95));
- // Need to change the permissions to match the original file
- // permissions because of a bug in upload
- Process p = remoteShellExec(
- config,
- "", "chmod", "+x " + spaceEscapify(remoteExePath), subMonitor.split(5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- // Wait if necessary for the permission change
- try {
- int timeOut = 10;
- boolean exited = p.waitFor(timeOut, TimeUnit.SECONDS);
-
- if (!exited) {
- Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR,
- "Failed to change file permissions in the remote system, path: " + remoteExePath, //$NON-NLS-1$
- null);
- throw new CoreException(status);
- }
- } catch (InterruptedException e) {
- Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR,
- "Interrupted while changing file permissions in the remote system, path: " //$NON-NLS-1$
- + remoteExePath,
- e);
- throw new CoreException(status);
- }
+ /* Force the file to executable. */
+ IFileInfo remoteFileInfo = remoteFile.fetchInfo();
+
+ remoteFileInfo.setAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE, true);
+ remoteFileInfo.setAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE, true);
+ remoteFileInfo.setAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE, true);
+
+ remoteFile.putInfo(remoteFileInfo, EFS.SET_ATTRIBUTES, subMonitor.split(5));
} catch (CoreException e) {
abort(Messages.RemoteRunLaunchDelegate_6, e,
ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);

Back to the top