ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Rob (Global Trade)" <Rob.Ander...@nike.com>
Subject RE: Sshexec fail on starting a service (websphere)
Date Fri, 05 Mar 2004 18:12:36 GMT
> -----Original Message-----
> From: Steve Loughran [mailto:steve_l@iseran.com]
> Sent: Friday, March 05, 2004 2:11 AM
> To: Ant Developers List
> Subject: Re: Sshexec fail on starting a service (websphere)
> 
> 
> Anderson, Rob (Global Trade) wrote:
> > 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?

The decision to return a status code was probably made before I was born. If there were a
machine that ran Java as it's OS, rather than a java vm on top of solaris/linux/hpux/windows/etc,
we could have such an environment where exceptions could be thrown to the parent process.

-Rob Anderson

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


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


Mime
View raw message