The only trouble I have run into using this approach is that the runCommand does not bubble up error code or exit code from the command being executed on a remote machine. This is a complete fail in my book. You have to know that your process works and be notified when it does not. In the mean time, the work around for my process works like this.
We kick this job off from Nant, so I capature the text output from the remote command, put it into a variable and than run a Regular Expression against it to determine if the remote process finished successfully or not.
Here is what this looks like in Nant ( oh.. that is some ugly xml)
So what is happening here?
The output of the exec command is being sent to a text file using the Output attribute.
The text file is then loaded into a variable called deploystep2.
The reg ex parses out the Build Success or Build Failed text from the file.
If build Failed is found than the <fail> tag fails the deployment and than the rest of our reporting process works as planned.