diff options
Diffstat (limited to 'cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java')
-rw-r--r-- | cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/RemoteHelper.java | 28 |
1 files changed, 26 insertions, 2 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 153c174fa46..bc389c24cb2 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 @@ -17,7 +17,9 @@ package org.eclipse.cdt.launch.remote; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.concurrent.TimeUnit; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.internal.launch.remote.Activator; @@ -113,9 +115,28 @@ public class RemoteHelper { localFile.copy(remoteFile, EFS.OVERWRITE, monitor); // Need to change the permissions to match the original file // permissions because of a bug in upload - remoteShellExec( + Process p = remoteShellExec( config, "", "chmod", "+x " + spaceEscapify(remoteExePath), new SubProgressMonitor(monitor, 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); + } } catch (CoreException e) { abort(Messages.RemoteRunLaunchDelegate_6, e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); @@ -200,7 +221,10 @@ public class RemoteHelper { if (!prelaunchCmd.trim().equals("")) //$NON-NLS-1$ remoteCommand = prelaunchCmd + CMD_DELIMITER + remoteCommand; - IRemoteConnection conn = getCurrentConnection(config); + IRemoteConnection conn = getCurrentConnection(config); + if (!conn.isOpen()) { + conn.open(monitor); + } IRemoteCommandShellService shellService = conn.getService(IRemoteCommandShellService.class); IRemoteProcess p = null; |