mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-05-08 13:31:24 +00:00
add two flags to set when a command is considered to be failed
This commit is contained in:
parent
ca79696711
commit
a90269560f
|
|
@ -83,6 +83,7 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
|
|||
fclose($pipes[0]);
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
|
||||
if ($timeleft <= 0) {
|
||||
proc_terminate($process);
|
||||
throw new Exception("command timeout after ".$orgtimeout." secs on: " . $cmd);
|
||||
|
|
@ -98,6 +99,10 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
|
|||
$this->to = $to;
|
||||
$this->cmd = $cmd;
|
||||
$this->timeout = ((int) $timeout) ? (int) $timeout : 5;
|
||||
/* Command fails if stderr is not empty */
|
||||
$this->failonstderr = true;
|
||||
/* Command fails if return code is not 0 */
|
||||
$this->failonretcode = false;
|
||||
}
|
||||
|
||||
public function getInfo() {
|
||||
|
|
@ -178,9 +183,17 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
|
|||
}
|
||||
if(!empty($ret['stderr'])) {
|
||||
if($this->logger) {
|
||||
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with cmd "'.$this->cmd.'" failed: '.$ret['stderr'], PEAR_LOG_ERR);
|
||||
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with cmd "'.$this->cmd.'" failed: stderr is '.$ret['stderr'], PEAR_LOG_ERR);
|
||||
}
|
||||
return false;
|
||||
if ($this->failonstderr)
|
||||
return false;
|
||||
}
|
||||
if(!empty($ret['return'])) {
|
||||
if($this->logger) {
|
||||
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with cmd "'.$this->cmd.'" failed: Error code '.$ret['return'], PEAR_LOG_ERR);
|
||||
}
|
||||
if ($this->failonretcode)
|
||||
return false;
|
||||
}
|
||||
$end = microtime(true);
|
||||
if($this->logger) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user