Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 52422 Details for
Bug 158786
Remote shell remains open from C/C++ remote application launch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to close the Remote Shell process.
patch_158786.txt (text/plain), 3.43 KB, created by
Martin Oberhuber
on 2006-10-20 15:58:18 EDT
(
hide
)
Description:
Patch to close the Remote Shell process.
Filename:
MIME Type:
Creator:
Martin Oberhuber
Created:
2006-10-20 15:58:18 EDT
Size:
3.43 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.remotecdt >Index: src/org/eclipse/rse/remotecdt/RemoteRunLaunchDelegate.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/RemoteRunLaunchDelegate.java,v >retrieving revision 1.5 >diff -u -r1.5 RemoteRunLaunchDelegate.java >--- src/org/eclipse/rse/remotecdt/RemoteRunLaunchDelegate.java 19 Sep 2006 21:57:14 -0000 1.5 >+++ src/org/eclipse/rse/remotecdt/RemoteRunLaunchDelegate.java 20 Oct 2006 08:36:07 -0000 >@@ -55,6 +55,8 @@ > > private final static String SHELL_SERVICE = "shell.service"; //$NON-NLS-1$ > private final static String FILE_SERVICE = "file.service"; //$NON-NLS-1$ >+ private final static String EXIT_CMD = "exit"; //$NON-NLS-1$ >+ private final static String CMD_DELIMITER = ";"; //$NON-NLS-1$ > > /* > * (non-Javadoc) >@@ -259,8 +261,13 @@ > > protected Process remoteShellExec(ILaunchConfiguration config, String remoteCommandPath, > String arguments) throws CoreException { >- String remote_command = arguments == null ? spaceEscapify(remoteCommandPath) : >+ // The exit command is called to force the remote shell to close after our command >+ // is executed. This is to prevent a running process at the end of the debug session. >+ // See Bug 158786. >+ String real_remote_command = arguments == null ? spaceEscapify(remoteCommandPath) : > spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$ >+ String remote_command = real_remote_command + CMD_DELIMITER + EXIT_CMD; >+ > IShellService shellService = (IShellService) getConnectedRemoteService(config, SHELL_SERVICE); > > // This is necessary because runCommand does not actually run the command right now. >Index: src/org/eclipse/rse/remotecdt/HostShellAdapter.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/examples/org.eclipse.rse.remotecdt/src/org/eclipse/rse/remotecdt/HostShellAdapter.java,v >retrieving revision 1.1 >diff -u -r1.1 HostShellAdapter.java >--- src/org/eclipse/rse/remotecdt/HostShellAdapter.java 19 Sep 2006 21:31:22 -0000 1.1 >+++ src/org/eclipse/rse/remotecdt/HostShellAdapter.java 20 Oct 2006 08:36:07 -0000 >@@ -48,6 +48,8 @@ > hostShell.exit(); > notifyAll(); > try { >+ hostShellInput.close(); >+ hostShellError.close(); > inputStream.close(); > errorStream.close(); > outputStream.close(); >@@ -56,7 +58,7 @@ > } > } > >- public int exitValue() { >+ public synchronized int exitValue() { > if(hostShell.isActive()) > throw new IllegalThreadStateException(); > // No way to tell what the exit value was. >@@ -76,8 +78,30 @@ > } > > public synchronized int waitFor() throws InterruptedException { >- while(hostShell.isActive()) >- wait(); >+ >+ while(hostShell.isActive()) { >+ try { >+ wait(1000); >+ } catch (InterruptedException e) { >+ // ignore because we're polling to see if shell is still active. >+ } >+ } >+ >+ try { >+ // Wait a second to try to get some more output from the target shell before closing. >+ wait(1000); >+ // Allow for the data from the stream to be read if it's available >+ if (inputStream.available() != 0 || errorStream.available() != 0) >+ throw new InterruptedException(); >+ >+ hostShellInput.close(); >+ hostShellError.close(); >+ inputStream.close(); >+ errorStream.close(); >+ outputStream.close(); >+ } catch (IOException e) { >+ // Ignore >+ } > return 0; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 158786
: 52422