Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dsdp-tm-dev] "Run a command" functionality

Yes, but that’s not a good solution.

 

From: dsdp-tm-dev-bounces@xxxxxxxxxxx [mailto:dsdp-tm-dev-bounces@xxxxxxxxxxx] On Behalf Of David McKnight
Sent: Monday, June 20, 2011 10:16 AM
To: Target Management developer discussions
Cc: Target Management developer discussions; dsdp-tm-dev-bounces@xxxxxxxxxxx
Subject: Re: [dsdp-tm-dev] "Run a command" functionality

 

There's no nice API way to get the exit value although I suppose you could get it via the shell I/O by using "echo $?".

____________________________________
David McKnight
Phone: 905-413-3902 , T/L: 969-3902
Internet: dmcknigh@xxxxxxxxxx
Mail: D1/YFY/8200/TOR
____________________________________


Inactive hide details for "Schaefer, Doug" ---20/06/2011 09:52:45 AM---Can you get the exit value of the command from there? (S"Schaefer, Doug" ---20/06/2011 09:52:45 AM---Can you get the exit value of the command from there? (Sorry, don't have the source in front of me).


From:


"Schaefer, Doug" <Doug.Schaefer@xxxxxxxxxxxxx>


To:


Target Management developer discussions <dsdp-tm-dev@xxxxxxxxxxx>


Cc:


"dsdp-tm-dev-bounces@xxxxxxxxxxx" <dsdp-tm-dev-bounces@xxxxxxxxxxx>


Date:


20/06/2011 09:52 AM


Subject:


Re: [dsdp-tm-dev] "Run a command" functionality


Sent by:


dsdp-tm-dev-bounces@xxxxxxxxxxx





Can you get the exit value of the command from there? (Sorry, don’t have the source in front of me).

From: dsdp-tm-dev-bounces@xxxxxxxxxxx [mailto:dsdp-tm-dev-bounces@xxxxxxxxxxx] On Behalf Of David McKnight
Sent:
Monday, June 20, 2011 8:20 AM
To:
Target Management developer discussions
Cc:
Target Management developer discussions; dsdp-tm-dev-bounces@xxxxxxxxxxx
Subject:
Re: [dsdp-tm-dev] "Run a command" functionality

Hi Vladimer,

I'm not sure whether this will solve all your requirements but you might want to try using SimpleCommandOperation.

SimpleCommandOperation cmdOp = new SimpleCommandOperation(cmdss, remoteFile, false);
cmdOp.runCommand(<cmd>, true);

String line = cmdOp.readLine(true);
while (line != null){
// process line
...
line = cmdOp.readLine(true);
}



____________________________________
David McKnight
Phone: 905-413-3902 , T/L: 969-3902
Internet:
dmcknigh@xxxxxxxxxx
Mail: D1/YFY/8200/TOR
____________________________________


Inactive hide details for Vladimir Prus ---18/06/2011 05:12:27 AM---Hello, in a few cases in our product, we're interested in jVladimir Prus ---18/06/2011 05:12:27 AM---Hello, in a few cases in our product, we're interested in just running a command remotely,


From:


Vladimir Prus <vladimir@xxxxxxxxxxxxxxxx>


To:


Target Management developer discussions <dsdp-tm-dev@xxxxxxxxxxx>


Date:


18/06/2011 05:12 AM


Subject:


[dsdp-tm-dev] "Run a command" functionality


Sent by:


dsdp-tm-dev-bounces@xxxxxxxxxxx







Hello,

in a few cases in our product, we're interested in just running a command remotely,
getting its exit status and output. At the same time, it's explicitly not desirable
to show the user any console window with the command output.

RSE provides shell service, which can be used to run a command, however this is
good for interactive use, and has some problems when used to run a single
command:

- The commands see they have a terminal, and starts to behave interactively, like
asking the user some questions, which is bad in our case.
- There's no clear way to obtain command error status. Per Anna's suggestion,
we used

; echo "Exit status is $?"

but assumes such output is not shown by the program, and the last line of program
output ends with newline, that we have a Linux target, and so on.
- In addition to program output, there is output produced when logging in into the
remote system, so we have to use some kludges to filter that out.

It seems to me that it would be best if this complexity (which seems specific to
different connections methods) be incapsualted inside RSE. So, there should be
an API to run a command, which can be implemented:

- Using SSH 'exec' channel for SSH connections
- Using the above "echo" trick for telnet connections
- Using whatever magic is necessary for DStore, or Windows, or other, connection types.

Does this seem to make sense? Shall I file a bug?

Thanks,

--
Vladimir Prus
CodeSourcery / Mentor Graphics
+7 (812) 677-68-40
_______________________________________________
dsdp-tm-dev mailing list
dsdp-tm-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dsdp-tm-dev
_______________________________________________
dsdp-tm-dev mailing list
dsdp-tm-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dsdp-tm-dev


Back to the top