Exemplo n.º 1
0
 /**
  * @param LocalFileNodeInterface $file
  * @param LocalFileNodeInterface $output
  * @param string                 $cmd
  * @param bool                   $keepOld
  *
  * @return LocalFileNodeInterface
  */
 protected function processFile(LocalFileNodeInterface $file, LocalFileNodeInterface $output, $cmd, $keepOld = true)
 {
     $process = $this->getProcess($cmd);
     $process->run();
     if (!$process->isSuccessful() || !$output->exists()) {
         throw new ProcessFailedException($process);
     }
     if ($file->exists() && !$keepOld) {
         $this->log(LogLevel::DEBUG, "Deleting old file: '{file}'", ['file' => $file]);
         $file->delete();
     }
     return $output;
 }