Beispiel #1
0
 public function afterAction(WSL_Compiler_Manager $manager)
 {
     // Arquivo Principal
     if (!$manager->getContext()->has('document.dvi')) {
         // Arquivo não Encontrado. Existe?
         throw new WSL_Compiler_PluginException("Where's 'document.dvi'?");
     }
 }
Beispiel #2
0
 public function afterAction(WSL_Compiler_Manager $manager)
 {
     // Plugin para 'document.pdf'
     $manager->execute('pdf');
     // Criação de Descritores
     $descriptors = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
     // Processamento
     $process = proc_open('tar cpzf document.tar.gz *', $descriptors, $pipes);
     // Recurso Inicializado?
     if (is_resource($process)) {
         // Saídas Padrão e de Erro
         $stdout = '';
         $stderr = '';
         // Ocioso
         $idle = true;
         // Executar até Finalização
         while ($idle) {
             // Tempo Ocioso
             usleep(500);
             // 0.5 Segundos
             // Capturar Saídas
             $stdout = $stdout . stream_get_contents($pipes[1]);
             $stderr = $stderr . stream_get_contents($pipes[2]);
             // Informações sobre Processo
             $information = proc_get_status($process);
             // Continuar Ocioso?
             $idle = $information !== false && $information['running'];
         }
         // Finalizar Pipes
         fclose($pipes[1]);
         fclose($pipes[2]);
         // Finalizar Processo
         proc_close($process);
     }
     // Criação de Arquivo de Saída
     $manager->getContext()->touch('document.tar.gz');
     // Informar Arquivo de Saída
     $manager->getContext()->setOutput('document.tar.gz');
 }