You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Carsten Dreesbach <ca...@oracle.com> on 2020/04/24 00:15:34 UTC

Question about usage of org.apache.commons.exec.ExecuteWatchdog

I'm a little confused about why the code example 
<https://github.com/apache/commons-exec/blob/4055e401ef7e4ad763cc69b892135b449baf0f13/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java#L32-L34> 
says to check executor.isFailure(exitValue) to see if the process was 
killed by the watchdog. Since the only way that 
watchdog.killedProcess())could ever return true, why would the extra 
exit status be necessary? It seems to me that just checking 
watchdog.killedProcess() by itself would be sufficient - or am I missing 
something here?


Thanks,

Carsten


Re: Question about usage of org.apache.commons.exec.ExecuteWatchdog

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi Carsten,

I guess the documentation is indeed misleading - it is there for 15 years :-)

Maybe it was intended as

if (executor.isFailure(exitValue) || watchdog.killedProcess()) {
	// failed or was killed on purpose by the watchdog
}


Thanks in advance, 

Siegfried Goeschl


> On 24.04.2020, at 02:15, Carsten Dreesbach <ca...@oracle.com> wrote:
> 
> I'm a little confused about why the code example <https://github.com/apache/commons-exec/blob/4055e401ef7e4ad763cc69b892135b449baf0f13/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java#L32-L34> says to check executor.isFailure(exitValue) to see if the process was killed by the watchdog. Since the only way that watchdog.killedProcess())could ever return true, why would the extra exit status be necessary? It seems to me that just checking watchdog.killedProcess() by itself would be sufficient - or am I missing something here?
> 
> 
> Thanks,
> 
> Carsten
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org