mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-10-04 15:12:30 +00:00
log error when execution of command fails
This commit is contained in:
parent
27b19f5c3a
commit
6fd8d3e7f5
|
@ -49,6 +49,7 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
|
||||||
);
|
);
|
||||||
$pipes = array();
|
$pipes = array();
|
||||||
|
|
||||||
|
$orgtimeout = $timeout;
|
||||||
$timeout += time();
|
$timeout += time();
|
||||||
// Putting an 'exec' before the command will not fork the command
|
// Putting an 'exec' before the command will not fork the command
|
||||||
// and therefore not create any child process. proc_terminate will
|
// and therefore not create any child process. proc_terminate will
|
||||||
|
@ -84,7 +85,7 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
|
||||||
fclose($pipes[2]);
|
fclose($pipes[2]);
|
||||||
if ($timeleft <= 0) {
|
if ($timeleft <= 0) {
|
||||||
proc_terminate($process);
|
proc_terminate($process);
|
||||||
throw new Exception("command timeout on: " . $cmd);
|
throw new Exception("command timeout after ".$orgtimeout." secs on: " . $cmd);
|
||||||
} else {
|
} else {
|
||||||
$return_value = proc_close($process);
|
$return_value = proc_close($process);
|
||||||
return array('stdout'=>$output, 'stderr'=>$error, 'return'=>$return_value);
|
return array('stdout'=>$output, 'stderr'=>$error, 'return'=>$return_value);
|
||||||
|
@ -169,6 +170,9 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
|
||||||
if($hastempfile)
|
if($hastempfile)
|
||||||
unlink($tmpfile);
|
unlink($tmpfile);
|
||||||
$this->success = false;
|
$this->success = false;
|
||||||
|
if($this->logger) {
|
||||||
|
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with cmd "'.$this->cmd.'" failed: '.$e->getMessage(), PEAR_LOG_ERR);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$end = microtime(true);
|
$end = microtime(true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user