Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Target Management » RemoteCommandShellOperation seems not to work
RemoteCommandShellOperation seems not to work [message #30063] Thu, 27 November 2008 16:41 Go to next message
lars gersmann is currently offline lars gersmannFriend
Messages: 77
Registered: July 2009
Member
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 #30101 is a reply to message #30063] Thu, 27 November 2008 16:53 Go to previous messageGo to next message
lars gersmann is currently offline lars gersmannFriend
Messages: 77
Registered: July 2009
Member
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 #30212 is a reply to message #30101] Wed, 03 December 2008 20:43 Go to previous message
Martin Oberhuber is currently offline Martin OberhuberFriend
Messages: 985
Registered: July 2009
Senior Member
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 16:53 Go to previous message
lars gersmann is currently offline lars gersmannFriend
Messages: 77
Registered: July 2009
Member
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 20:43 Go to previous message
Martin Oberhuber is currently offline Martin OberhuberFriend
Messages: 985
Registered: July 2009
Senior Member
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
>
Previous Topic:Re: Remote debugging question
Next Topic:TM 3.0.2 is released
Goto Forum:
  


Current Time: Sat Dec 20 06:49:45 GMT 2014

Powered by FUDForum. Page generated in 0.02488 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software