Yeah, we do have outputproperty but the exit status can tell you why a command 
failed or how it exited without having to parse the output.

 

This is how we could change it:

 

                // add a global variable

                private String exitStatusProperty = null;

                

                // add a setter method

                public void setExitstatusproperty(String property) {

                                exitStatusProperty = property;

                }

                

                // add to the executeCommand method before "if (ec != 0)"

                int ec = channel.getExitStatus();

                if (exitStatusProperty != null) {

                                getProject().setNewProperty(exitStatusProperty, 
""+ Integer.toString(ec));

                }

From: Martin Gainty [mailto:mgai...@hotmail.com] 
Sent: Wednesday, April 13, 2011 6:34 PM
To: Ant Developers List
Subject: RE: SSHExec - Feature request

 

Dustin

i thought ant sshexec task attriobute of outputproperty would accept the output 
from the command  to a property?

i would begoff -e which is escape character for unix ssh tasks
http://www.stat.duke.edu/comp/security/ssh_man.html

your refactor did'nt make it thru...you might want to consider inlining the 
code to message body so we can see the refactor
thanks,
Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und 
Vertraulichkeitanmerkung/Note de déni et de confidentialité

 

Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy 
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése 
nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi 
alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen 
megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet 
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.







________________________________

Subject: SSHExec - Feature request
Date: Wed, 13 Apr 2011 12:10:06 -0700
From: dmowcom...@automotive.com
To: dev@ant.apache.org

I would like to suggest that we add an attribute to SSHExec called 
exitStatusProperty so that the exit status can be set to a property when the 
ssh command is finished.

 

There would be many uses for this such as testing if a file exists on an ssh 
server by executing 'test -e ${file}' which return with an exit code of 0 if 
exists or 1 if doesn't exist.

 

I've attached the necessary changes if anyone wants to commit them.

 

Dustin Mowcomber

Software Build Engineer

dmowcom...@automotive.com 

 

tel.

949.705.3260

Source Interlink Media logo

Error! Filename not specified.

Source Interlink Media

1733 Alton Pkwy, Irvine, CA 92606

www.automotive.com 

Confidentiality Notice- This electronic communication, and all information 
herein, including files attached hereto, is private, and is the property of the 
sender. This communication is intended only for the use of the individual or 
entity named above. If you are not the intended recipient, you are hereby 
notified that any disclosure of; dissemination of; distribution of; copying of; 
or, taking any action in reliance upon this communication, is strictly 
prohibited. If you have received this communication in error, please 
immediately notify us by telephone, (714)-389-5000, and destroy all copies of 
this communication. Thank you.

 

 


--------------------------------------------------------------------- To 
unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, 
e-mail: dev-h...@ant.apache.org 

Reply via email to