In order to fix this, I had to write a macrodef that strips the last character (no matter what it is being that you can't test for it):
<macrodef name="stripLastChar" description="Drops the last char off of property value"> <attribute name="my.property.name"/> <sequential> <length string="$...@{my.property.name}}" property="length.prop" /> <math result="length.prop" operand1="${length.prop}" operation="-" operand2="1" datatype="int"/> <propertyregex property="@{my.property.name}" override="true" input="$...@{my.property.name}}" regexp="^.*{${length.prop},${length.prop}}" select="\0"/> </sequential> </macrodef> I would consider the behavior of sshexec a bug. Anyone else... ________________________________ From: Eric Fetzer <elstonk...@yahoo.com> To: Ant Users List <user@ant.apache.org> Sent: Wednesday, August 5, 2009 12:19:13 PM Subject: Re: sshexec I tried: <propertyregex property="my.property" override="true" input="${my.property}" regexp="\r" replace="" /> <propertyregex property="my.property" override="true" input="${my.property}" regexp="\n" replace="" /> But it doesn't seem to work on newline/cr stuff... This is nuts, is what I'm trying to do really all that tough? ________________________________ From: Eric Fetzer <elstonk...@yahoo.com> To: Ant Users <user@ant.apache.org> Sent: Wednesday, August 5, 2009 11:10:36 AM Subject: sshexec So sshexec is adding a carriage return to the outputproperty when run from winders. Is there a way to strip this off of the end of a property in ant? Here's a small repro: test.sh: <!--Begin Code Snip--> echo "error" | tr '\n' '' | tr '\r' '' exit 0 <!--End Code Snip--> testSshExec.xml <!--Begin Code Snip--> <project default="main"> <task name="main"> <sshexec host="${ssh.host}" username="${ssh.user}" keyfile="${ssh.keyfile}" passphrase="${ssh.passphrase}" command="/home/myUser/test.sh" trust="true" timeout="1000" outputproperty="returnValue" /> </task> <echo message="XXX${returnValue}XXX"/> </project> <!--End Code Snip--> Run from winders machine, return is: main: [sshexec] Connecting to myUnixBox:22 [sshexec] error [echo] XXXerror [echo] XXX BUILD SUCCESSFUL Total time: 3 seconds Thanks, Eric