Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » capturing output of remote run process
capturing output of remote run process [message #24828] Tue, 03 June 2008 11:33 Go to next message
Abhijit is currently offline AbhijitFriend
Messages: 18
Registered: July 2009
Junior Member
Hi All,

I am using eclipse 3.4M7 with 0.95RC2 DLTK and RSE-SDK-3.0RC1.

In my IDE,I am able to create a project in remote location (unix) with the
help of Remote System Explorer.

I am able to create scripts under that project in remote location. I have
set interpreter details of remote location and when I try to run the
script , it succesfully forms the command line and fires it. But I am not
getting any output in the console.

Is there any option to capture the output of the remote process and show
it in console?

Please Help.

regards,
Abhijit.
Re: capturing output of remote run process [message #24961 is a reply to message #24828] Tue, 03 June 2008 14:35 Go to previous messageGo to next message
Andrei Sobolev is currently offline Andrei SobolevFriend
Messages: 72
Registered: July 2009
Member
Hi Abhijit,

> Hi All,
>
> I am using eclipse 3.4M7 with 0.95RC2 DLTK and RSE-SDK-3.0RC1.
>
> In my IDE,I am able to create a project in remote location (unix) with
> the help of Remote System Explorer.
>
> I am able to create scripts under that project in remote location. I
> have set interpreter details of remote location and when I try to run
> the script , it succesfully forms the command line and fires it. But I
> am not getting any output in the console.
>
> Is there any option to capture the output of the remote process and show
> it in console?

Could you please be a bit more specific.

1) Do you use DLTK launching infrastructure? Or you have your own.
2) Does it not work only for Remote projects? And work for local.
3) Do you want to use standard eclipse input/output console, provided by debug plugin? Or you want your own console?

For standard consoles to be shown following value in launch configurations should be set
IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE to null.
You could check it from your LaunchConfigurationDelegate or AbstractScriptLaunchConfigurationDelegate based class, from
launch() method.

Best regards,
Andrei Sobolev.
Re: capturing output of remote run process [message #24982 is a reply to message #24961] Wed, 04 June 2008 08:27 Go to previous messageGo to next message
Abhijit is currently offline AbhijitFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Andrei,
Thank you for your help. I would reiterate our query to be more clear.

I have created my IDE for our domain language using DLTK framework (using
eclipse 3.4M7 with 0.95RC2 DLTK and RSE-SDK-3.0RC1.) We have referred ruby
IDE for the same.

-> 1) Do you use DLTK launching infrastructure? Or you have your own.
We are using DLTK launching infrastructure.

-> 2) Does it not work only for Remote projects? And work for local.

Yes.
I have created scripts under both local as well as remote projects. I have
set interpreter details for both locations (local and remote).

when I try to run the local script (in local project),it succesfully forms
the command line and fires it and shows the output in console of IDE. But
when I try to run the remote script (in remote project),it succesfully
forms the command line and fires it but does not show the output in
console of IDE. i.e. It shows the output in the console only for scripts
in local projects but not for scripts in Remote projects.

->3) Do you want to use standard eclipse input/output console, provided by
debug plugin? Or you want your own console?

Yes, I want the output of scripts (for remote project) execution to be
displayed in standard console provided by DEbugPlugin.

I tried to set IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE to null in launch
method of LaunchConfigurationDelegate in following way :

launch.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOL E, null);

Here launch is an object of ILaunch. But it doesn't work. Is this the
right way or am I doing it wrongly?

Please Help.

Thanks & regards,
Abhijit.
Re: capturing output of remote run process [message #25052 is a reply to message #24982] Thu, 05 June 2008 06:37 Go to previous messageGo to next message
Andrei Sobolev is currently offline Andrei SobolevFriend
Messages: 72
Registered: July 2009
Member
Hi Abhijit,

I suppose what problem is not in console. But in remote execution.

Could you please try to debug RSEExecEnvironment.exec() method from org.eclipse.dltk.rse.core plugin.
This method is called on command execution for remote host. To check that is works, please add System.out.println() in
MyHostShellProcessAdapter.shellOutputChanged() method. All output from RSE execution are came here.

Do you use ssh or dstore connection? Does your remote host contain "bash"?
We called it as command interpreter. This unifies passing of environment variables, etc.

Best regards,
Andrei Sobolev.


> Hi Andrei,
> Thank you for your help. I would reiterate our query to be more clear.
>
> I have created my IDE for our domain language using DLTK framework
> (using eclipse 3.4M7 with 0.95RC2 DLTK and RSE-SDK-3.0RC1.) We have
> referred ruby IDE for the same.
>
> -> 1) Do you use DLTK launching infrastructure? Or you have your own.
> We are using DLTK launching infrastructure.
>
> -> 2) Does it not work only for Remote projects? And work for local.
>
> Yes.
> I have created scripts under both local as well as remote projects. I
> have set interpreter details for both locations (local and remote).
>
> when I try to run the local script (in local project),it succesfully
> forms the command line and fires it and shows the output in console of
> IDE. But when I try to run the remote script (in remote project),it
> succesfully forms the command line and fires it but does not show the
> output in console of IDE. i.e. It shows the output in the console only
> for scripts in local projects but not for scripts in Remote projects.
>
> ->3) Do you want to use standard eclipse input/output console, provided
> by debug plugin? Or you want your own console?
>
> Yes, I want the output of scripts (for remote project) execution to be
> displayed in standard console provided by DEbugPlugin.
> I tried to set IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE to null in
> launch method of LaunchConfigurationDelegate in following way :
>
> launch.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOL E, null);
>
> Here launch is an object of ILaunch. But it doesn't work. Is this the
> right way or am I doing it wrongly?
>
> Please Help.
>
> Thanks & regards,
> Abhijit.
>
Re: capturing output of remote run process [message #25340 is a reply to message #25052] Tue, 10 June 2008 04:29 Go to previous messageGo to next message
Abhijit is currently offline AbhijitFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Andrei,

I have done as you said i.e to put System.out.println() in
MyHostShellProcessAdapter.shellOutputChanged() method.

I have checked the output in the method and it is coming in the method.
However, in this method there is a for loop, inside which we are checking
"if (line.trim().equals(this.pattern1)) ". But in our case, when we log on
to unix terminal, we have to chose a module area and then command prompt
appear. Hence, there is a mismatch in the output. The pattern appears in
form "<command prompt>pattern1"; hence the equals method fails.

So in this case we changed the if statement to use endswith instead of
equals-"if (line.trim().endsWith(this.pattern1))". When we do this change,
the output appears in the console.

Can we somehow get a handle at this point to customise the method to
follow our logon procedure into unix terminal and then call
MyHostShellProcessAdapter.shellOutputChanged() so that the existing code
may work?

Thanks & regards,
Abhijit.
Re: capturing output of remote run process [message #25380 is a reply to message #25340] Tue, 10 June 2008 06:11 Go to previous messageGo to next message
Andrei Sobolev is currently offline Andrei SobolevFriend
Messages: 72
Registered: July 2009
Member
Hi Abhijit,

We have fix in 0.95RC3, which uses endsWith() in this place.
Could you please check 0.95RC3.

Best regards,
Andrei Sobolev.

> Hi Andrei,
>
> I have done as you said i.e to put System.out.println() in
> MyHostShellProcessAdapter.shellOutputChanged() method.
>
> I have checked the output in the method and it is coming in the method.
> However, in this method there is a for loop, inside which we are
> checking "if (line.trim().equals(this.pattern1)) ". But in our case,
> when we log on to unix terminal, we have to chose a module area and then
> command prompt appear. Hence, there is a mismatch in the output. The
> pattern appears in form "<command prompt>pattern1"; hence the equals
> method fails.
>
> So in this case we changed the if statement to use endswith instead of
> equals-"if (line.trim().endsWith(this.pattern1))". When we do this
> change, the output appears in the console.
> Can we somehow get a handle at this point to customise the method to
> follow our logon procedure into unix terminal and then call
> MyHostShellProcessAdapter.shellOutputChanged() so that the existing code
> may work?
>
> Thanks & regards,
> Abhijit.
>
>
Re: capturing output of remote run process [message #25684 is a reply to message #25380] Fri, 13 June 2008 09:12 Go to previous messageGo to next message
Abhijit is currently offline AbhijitFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Andrei,

Thanks a lot for your responce. Now we are getting the output of remote
project in our console.

But now the output comes as command prompt (of unix) followed by required
output.

On going through the code we have observed that in the method
MyHostShellProcessAdapter.shellOutputChanged() we have the following code:

if (trimLine.endsWith(this.pattern1)) {
if (!trimLine.equals(this.pattern1)) {
// We need to output part of line
int pos = line.indexOf(this.pattern1);
outputStream.write(line.substring(0, pos).getBytes());
outputStream.write('\n');
outputStream.flush();
}
}
In the second if condition the line from 0 to pos is written to
outputstream. Hence the command prompt appears in output, which we don't
require. We want the output between the patterns only to be displayed.

Can we have the second if condition removed in the next release?

Please Help.
Re: capturing output of remote run process [message #25806 is a reply to message #25684] Mon, 16 June 2008 03:25 Go to previous messageGo to next message
Andrei Sobolev is currently offline Andrei SobolevFriend
Messages: 72
Registered: July 2009
Member
Hi Abhijit,
> Hi Andrei,
>
> Thanks a lot for your responce. Now we are getting the output of
> remote project in our console.
>
> But now the output comes as command prompt (of unix) followed by
> required output.
> On going through the code we have observed that in the method
> MyHostShellProcessAdapter.shellOutputChanged() we have the following code:
>
> if (trimLine.endsWith(this.pattern1)) {
> if (!trimLine.equals(this.pattern1)) {
> // We need to output part of line
> int pos = line.indexOf(this.pattern1);
> outputStream.write(line.substring(0, pos).getBytes());
> outputStream.write('\n');
> outputStream.flush();
> }
> }
> In the second if condition the line from 0 to pos is written to
> outputstream. Hence the command prompt appears in output, which we don't
> require. We want the output between the patterns only to be displayed.
>
> Can we have the second if condition removed in the next release?
Let's me explain why second if condition are required:

Lets use following script output:
%PATTERN%
Output line1
Output line2
Output line3%PATTERN%

There is no new line on end of output. Also this is happen then we have only one line with out new line symbol at end.
Without second if, we will receive no output.

Possibly solution for your case:
I suppose you could overwrite your command prompt passing environment variables PS1,PS2,PS4

With following values all output are fine:
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
PS2='> '
PS4='+ '

Also I suppose we could pass some default prompt from out code.
Thoughts?

Best regards,
Andrei Sobolev.
Re: capturing output of remote run process [message #25888 is a reply to message #25806] Mon, 16 June 2008 06:40 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080607010305010601000300
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

What about the attached patch?

- the pattern is looked for only in the stdout lines (not stderr)
- the beginning of the line is written only if output is active
- skip is replaced with prefixCounter == 1

Regards,
Alex

Andrei Sobolev wrote:
> Let's me explain why second if condition are required:
>
> Lets use following script output:
> %PATTERN%
> Output line1
> Output line2
> Output line3%PATTERN%
>
> There is no new line on end of output. Also this is happen then we have
> only one line with out new line symbol at end. Without second if, we
> will receive no output.
>
> Possibly solution for your case:
> I suppose you could overwrite your command prompt passing environment
> variables PS1,PS2,PS4
>
> With following values all output are fine:
> PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
> PS2='> '
> PS4='+ '
>
> Also I suppose we could pass some default prompt from out code.
> Thoughts?
>
> Best regards,
> Andrei Sobolev.


--------------080607010305010601000300
Content-Type: text/plain;
name="ShellProcessAdapter.patch"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="ShellProcessAdapter.patch"

IyMjIEVjbGlwc2UgV29ya3NwYWNlIFBhdGNoIDEuMA0KI1Agb3JnLmVjbGlw c2UuZGx0ay5y
c2UuY29yZQ0KSW5kZXg6IHNyYy9vcmcvZWNsaXBzZS9kbHRrL2NvcmUvaW50 ZXJuYWwvcnNl
L015SG9zdFNoZWxsUHJvY2Vzc0FkYXB0ZXIuamF2YQ0KPT09PT09PT09PT09 PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PQ0KUkNTIGZp
bGU6IC9jdnNyb290L3RlY2hub2xvZ3kvb3JnLmVjbGlwc2UuZGx0ay9yc2Uv cGx1Z2lucy9v
cmcuZWNsaXBzZS5kbHRrLnJzZS5jb3JlL3NyYy9vcmcvZWNsaXBzZS9kbHRr L2NvcmUvaW50
ZXJuYWwvcnNlL015SG9zdFNoZWxsUHJvY2Vzc0FkYXB0ZXIuamF2YSx2DQpy ZXRyaWV2aW5n
IHJldmlzaW9uIDEuNg0KZGlmZiAtdSAtcjEuNiBNeUhvc3RTaGVsbFByb2Nl c3NBZGFwdGVy
LmphdmENCi0tLSBzcmMvb3JnL2VjbGlwc2UvZGx0ay9jb3JlL2ludGVybmFs L3JzZS9NeUhv
c3RTaGVsbFByb2Nlc3NBZGFwdGVyLmphdmEJMTEgSnVuIDIwMDggMDk6NTA6 MDEgLTAwMDAJ
MS42DQorKysgc3JjL29yZy9lY2xpcHNlL2RsdGsvY29yZS9pbnRlcm5hbC9y c2UvTXlIb3N0
U2hlbGxQcm9jZXNzQWRhcHRlci5qYXZhCTE2IEp1biAyMDA4IDA2OjM0OjUz IC0wMDAwDQpA
QCAtMTczLDcgKzE3Myw2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XIgPT0gMSkgew0K IAkJCQkJb3V0
cHV0U3RyZWFtLndyaXRlKGxpbmUuZ2V0Qnl0ZXMoKSk7DQogCQkJCQlvdXRw dXRTdHJlYW0u
d3JpdGUoJ1xuJyk7DQogCQkJCQlvdXRwdXRTdHJlYW0uZmx1c2goKTsNCg==
--------------080607010305010601000300--
Re: capturing output of remote run process [message #25930 is a reply to message #25888] Mon, 16 June 2008 08:15 Go to previous messageGo to next message
Andrei Sobolev is currently offline Andrei SobolevFriend
Messages: 72
Registered: July 2009
Member
Hi Alex,

Yes, this will help.
I've applied the patch.
Next build of 0.95 will contain this fix.

Thanks,
Andrei.
> What about the attached patch?
>
> - the pattern is looked for only in the stdout lines (not stderr)
> - the beginning of the line is written only if output is active
> - skip is replaced with prefixCounter == 1
>
> Regards,
> Alex
>
> Andrei Sobolev wrote:
>> Let's me explain why second if condition are required:
>>
>> Lets use following script output:
>> %PATTERN%
>> Output line1
>> Output line2
>> Output line3%PATTERN%
>>
>> There is no new line on end of output. Also this is happen then we
>> have only one line with out new line symbol at end. Without second if,
>> we will receive no output.
>>
>> Possibly solution for your case:
>> I suppose you could overwrite your command prompt passing environment
>> variables PS1,PS2,PS4
>>
>> With following values all output are fine:
>> PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
>> PS2='> '
>> PS4='+ '
>>
>> Also I suppose we could pass some default prompt from out code.
>> Thoughts?
>>
>> Best regards,
>> Andrei Sobolev.
>
Re: capturing output of remote run process [message #26093 is a reply to message #25806] Tue, 17 June 2008 06:40 Go to previous message
Abhijit is currently offline AbhijitFriend
Messages: 18
Registered: July 2009
Junior Member
hi Andrei,

There is one more possible solution. The second if condition shown below-
if (trimLine.endsWith(this.pattern1)) {
if (!trimLine.equals(this.pattern1)) {
//code goes here
}
}
can be changed to - if ((prefixCounter == 1) &&
!trimLine.equals(this.pattern1)) {}

So that the second condition will be tested only for closing pattern and
not for opening.

Thanks & regards,
Abhijit.
Previous Topic:type hierarchy and code completion
Next Topic:ExtendedVariableReference and CallHolder vs. CallExpression and MethodCallExpression
Goto Forum:
  


Current Time: Fri Apr 12 16:51:45 GMT 2024

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

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

Back to the top