RemoteCommandShellOperation seems not to work [message #30063] |
Thu, 27 November 2008 11:41  |
Eclipse User |
|
|
|
hi guys,
i try (since ours ... :-) to figure out why my RemoteCommandShellOperation
does not work.
it seems to me that
RSECorePlugin.getTheSystemRegistry().addSystemResourceChange Listener(
listener);
not having an effect. the listener method is never called back.
not sure if this is important : i am working on a Local Linux connection.
source :
RemoteCommandShellOperation op = new RemoteCommandShellOperation(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShel l(),
ss,
remoteFile,
new NullProgressMonitor())
) {
// gets never called ...
public void handleCommandFinished(String cmd) {
System.out.println( "handleCommandFinished");
done = true;
}
// .. because output is never delivered via callback method
handleOutputChanged
public void handleOutputChanged(String command, Object output) {
System.out.println( "handleOutputChanged : " + output);
}
};
op.run();
op.sendCommand( host.getSystemType().isWindows() ? "set" : "env");
i crawled the newsgroup and found an example doing exactly the same like
me ... but it doesnt work on my machine.
i tried afterwards something like
RSECorePlugin.getTheSystemRegistry().addSystemResourceChange Listener(
this);
final String cmd = getDelegate().getHost().getSystemType().isWindows() ?
"set" : "env";
shell.writeToShell( cmd);
but again my ISystemResourceChangeListener is never called back.
anyway - there was output via shell.listOutput(); ... but i really thought
i can get notified as output arrives.
could somebody help me out ? what i am doing wrong ?
many regards,
lars
|
|
|
|
Re: RemoteCommandShellOperation seems not to work [message #30212 is a reply to message #30101] |
Wed, 03 December 2008 15:43  |
Eclipse User |
|
|
|
If your code happens to run in the main thread it's indeed your fault
because it's you blocking the event loop. Event notifications are always
sent on the main thread by RSE. Long-running tasks (like your code)
should be run in a Job.
You _can_ do Display.readAndDispatch() inside your polling loop, but
that's deprecated (since it may introduce ugly reentrancy problems).
Better run your operation from a Job.
Cheers,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm
lars gersmann wrote:
> ok - i answer myself :-)
>
> after sending a command
>
> op.run();
> op.sendCommand( host.getSystemType().isWindows() ? "set" : "env");
>
> i do something like
> ..
> while( !done) {
> Thread.currentThread().sleep( 150);
> }
> ..
>
> within the same thread. and that blocks for some reason the message
> devilvery via ISystemResourceChangeListener ...
> its anyway a bit strange : i thought processing cmd output is done
> asynchronously by rse...
>
> anyway, thats my fault.
>
> many regards,
> lars
>
|
|
|
Re: RemoteCommandShellOperation seems not to work [message #578039 is a reply to message #30063] |
Thu, 27 November 2008 11:53  |
Eclipse User |
|
|
|
ok - i answer myself :-)
after sending a command
op.run();
op.sendCommand( host.getSystemType().isWindows() ? "set" : "env");
i do something like
...
while( !done) {
Thread.currentThread().sleep( 150);
}
...
within the same thread. and that blocks for some reason the message
devilvery via ISystemResourceChangeListener ...
its anyway a bit strange : i thought processing cmd output is done
asynchronously by rse...
anyway, thats my fault.
many regards,
lars
|
|
|
Re: RemoteCommandShellOperation seems not to work [message #578098 is a reply to message #30101] |
Wed, 03 December 2008 15:43  |
Eclipse User |
|
|
|
If your code happens to run in the main thread it's indeed your fault
because it's you blocking the event loop. Event notifications are always
sent on the main thread by RSE. Long-running tasks (like your code)
should be run in a Job.
You _can_ do Display.readAndDispatch() inside your polling loop, but
that's deprecated (since it may introduce ugly reentrancy problems).
Better run your operation from a Job.
Cheers,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm
lars gersmann wrote:
> ok - i answer myself :-)
>
> after sending a command
>
> op.run();
> op.sendCommand( host.getSystemType().isWindows() ? "set" : "env");
>
> i do something like
> ..
> while( !done) {
> Thread.currentThread().sleep( 150);
> }
> ..
>
> within the same thread. and that blocks for some reason the message
> devilvery via ISystemResourceChangeListener ...
> its anyway a bit strange : i thought processing cmd output is done
> asynchronously by rse...
>
> anyway, thats my fault.
>
> many regards,
> lars
>
|
|
|
Powered by
FUDForum. Page generated in 0.06391 seconds