Community
Participate
Working Groups
After canceling a shell the Cancel Action is still enabled. Steps to Reproduce: Right Click on Local Shells. Select Launch Shell. Click the "Terminate the selected shell" button on the toolbar. OR Right click on the new Shell in the Remote Systems View and select Cancel Shell. The action is still enabled. -----------Enter bugs above this line----------- TM 2.0 Testing installation : eclipse-SDK-3.3 RSE install : RSE 2.0 java.runtime : Sun 1.5.0_11-b03 os.name: : Windows XP, Service Pack 2 ------------------------------------------------
Assigning to Kevin, our master of enablement. But I think it's really low priority.
Created attachment 75235 [details] Set the Action to disabled when the shell is terminated Legal Message: I, Kevin Doyle, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL.
I think the attached patch is not the right way of dealing with this. We'd like to set the terminate action disabled also when the user types "exit" in the shell, or the remote shell terminates itself for any reason. In that case, the *ShellOutputReader thread will terminate first, then also the *ShellThread will terminate. At that point, an ISystemResourceChangedEvent of type EVENT_COMMAND_SHELL_FINISHED must be fired. That event will lead to updating the action states, and greying out the background of the shell. It should also reset the "running" overlay of the shell node in the SystemView, so I suppose also an EVENT_REFRESH needs to be fired on that node OR the SystemView needs to react to EVENT_COMMAND_SHELL_FINISHED. When the user performs the "cancel shell" operation, exit is sent to the remote and the shell terminates; we should set the action disabled only as a result of the threads dying, just the same way as it should happen when the remote shell dies by itself. I'm looking at this also related to bug 161838 and bug 194898.
Passing the termination event information up the food chain is not trivial. What dstore does in DStoreShellOutputReader line 97, is send a dummy event (empty line) when the shell is really terminated. But I don't think this can also be applied to the others, since returning "null" in the readers is the mark that the reader is done. It seems more likely we can send a special kind of HostShellChangeEvent in the AbstractHostShellOutputReader#finish() method. When we send a HostShellChangeEvent without any lines, this could be the indicator that the upper layers need to check IHostShell#isActive() and perform the necessary steps. Actually, all the shells will create an OutputRefreshJob out of the HostShellChangeEvent, so we can use that one to send an EVENT_COMMAND_SHELL_FINISHED in case there are no lines in the job and IHostShell#isActive() returns false.
Created attachment 75334 [details] Patch for proper event sending when shell terminates Attached patch fixes the issue properly, by sending a synthetic "zero lines" output event when the shell is found to terminate. Upon receiving that event, when the IHostShell.isActive() is indeed false, the OutputRefreshJob performs the necessary refresh events on the system view and the commands view.
Patch committed: [197848] Fix shell terminated state when remote dies AbstractHostShellOutputReader.java OutputRefreshJob.java
Verified fixed with 2.0.1 RC1.