Overview

Namespaces

  • Budovy
  • Kdyby
    • BootstrapFormRenderer
      • DI
      • Latte
  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Diagnostics
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
      • Diagnostics
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • PhpGenerator
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
  • NetteModule
  • Nextras
    • Datagrid
  • None
  • PHP
  • Tester
    • CodeCoverage
    • Runner
      • Output
  • Vodacek
    • Forms
      • Controls
  • WebLoader
    • Filter
    • Nette

Classes

  • CoffeeScriptFilter
  • LessFilter
  • Process
  • StylusFilter
  • VariablesFilter
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: namespace WebLoader\Filter;
 4: 
 5: /**
 6:  * Simple process wrapper
 7:  *
 8:  * @author Patrik Votoček
 9:  * @license MIT
10:  */
11: class Process
12: {
13: 
14:     /**
15:      * @param string
16:      * @param string|NULL
17:      * @return string
18:      * @throws \RuntimeExeption
19:      */
20:     public static function run($cmd, $stdin = NULL)
21:     {
22:         $descriptorspec = array(
23:             0 => array('pipe', 'r'), // stdin
24:             1 => array('pipe', 'w'), // stdout
25:             2 => array('pipe', 'w'), // stderr
26:         );
27: 
28:         $pipes = array();
29:         $proc = proc_open($cmd, $descriptorspec, $pipes);
30: 
31:         if (!empty($stdin)) {
32:             fwrite($pipes[0], $stdin . PHP_EOL);
33:         }
34:         fclose($pipes[0]);
35: 
36:         $stdout = stream_get_contents($pipes[1]);
37:         $stderr = stream_get_contents($pipes[2]);
38: 
39:         $code = proc_close($proc);
40: 
41:         if ($code != 0) {
42:             throw new \RuntimeException($stderr, $code);
43:         }
44: 
45:         return $stdout;
46:     }
47: 
48: }
API documentation generated by ApiGen 2.8.0