mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 08:55:54 +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();
|
||||
|
||||
$orgtimeout = $timeout;
|
||||
$timeout += time();
|
||||
// Putting an 'exec' before the command will not fork the command
|
||||
// and therefore not create any child process. proc_terminate will
|
||||
|
@ -84,7 +85,7 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
|
|||
fclose($pipes[2]);
|
||||
if ($timeleft <= 0) {
|
||||
proc_terminate($process);
|
||||
throw new Exception("command timeout on: " . $cmd);
|
||||
throw new Exception("command timeout after ".$orgtimeout." secs on: " . $cmd);
|
||||
} else {
|
||||
$return_value = proc_close($process);
|
||||
return array('stdout'=>$output, 'stderr'=>$error, 'return'=>$return_value);
|
||||
|
@ -169,6 +170,9 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
|
|||
if($hastempfile)
|
||||
unlink($tmpfile);
|
||||
$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;
|
||||
}
|
||||
$end = microtime(true);
|
||||
|
|
Loading…
Reference in New Issue
Block a user