The sshexec task, jsch and ssh cannot be expected to anylize the output from a command that is run. This is why there is an exit status. The example of echo is a good one. Echo will succeed and report exit status 0 to the process that calls it. If you wish to anylize the output of echo, you need to do this in the parent process.
While I agree with everything you say, the limited scope of exit codes really irritates me.
all we have to return errors and success is a number, a number that can also be used in different ways by java.exe, and which behaves differently on different boxes.
This code snippet from the LGPL smartfrog tasks (smartfrog.org) show the problem. I am forking java, but java.exe can return things if it feels like it, so the program we fork knows to return -1 for an error -the switch statement should say 0==good, -1 error, else: trouble.
Only java1.4.2 on hpux seems to return 255 instead of -1 on exec. I can see a bit of platform specific details creeping in there, and it makes me unhappy.
switch(err) {
case 0:
return;
//-1 is an expected error, but
//for some reason smartfrog on HP-UX returns something else.
//so we catch 255 as well.
case -1:
case 255:
throw new BuildException(failureText);
default:
throw new BuildException(errorText+" - error code "+err);
}
Can we ever move to a world where executed programs throw a full exception up to the caller, rather than just return a status code?
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]