Development

Changeset 32432

You must first sign up to be able to contribute.

Changeset 32432

Show
Ignore:
Timestamp:
04/01/11 18:15:27 (4 years ago)
Author:
fabien
Message:

Merge branch 'master' of git://github.com/symfony/symfony

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.0/src/Symfony/Component/Process/Process.php

    r32364 r32432  
    7171     * from the independent process during execution. 
    7272     * 
    73      * If you don't provide a callback, the STDOUT and STDERR are available only after 
    74      * the process is finished via the getOutput() and getErrorOutput() methods. 
     73     * The STDOUT and STDERR are also available after the process is finished 
     74     * via the getOutput() and getErrorOutput() methods. 
    7575     * 
    7676     * @param Closure|string|array $callback A PHP callback to run whenever there is some 
     
    8585    public function run($callback = null) 
    8686    { 
    87         if (null === $callback) { 
    88             $this->stdout = ''; 
    89             $this->stderr = ''; 
    90             $that = $this; 
    91             $callback = function ($type, $line) use ($that) 
    92             { 
    93                 if ('out' == $type) { 
    94                     $that->addOutput($line); 
    95                 } else { 
    96                     $that->addErrorOutput($line); 
    97                 } 
    98             }; 
    99         } 
     87        $this->stdout = ''; 
     88        $this->stderr = ''; 
     89        $that = $this; 
     90        $callback = function ($type, $line) use ($that, $callback) 
     91        { 
     92            if ('out' == $type) { 
     93                $that->addOutput($line); 
     94            } else { 
     95                $that->addErrorOutput($line); 
     96            } 
     97 
     98            if (null !== $callback) { 
     99                call_user_func($callback, $type, $line); 
     100            } 
     101        }; 
    100102 
    101103        $descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')); 
  • branches/2.0/tests/Symfony/Tests/Component/HttpKernel/Debug/ExceptionListenerTest.php

    r32299 r32432  
    1414use Symfony\Component\HttpKernel\HttpKernelInterface; 
    1515use Symfony\Component\HttpKernel\Debug\ExceptionListener; 
    16 use Symfony\Component\HttpKernel\Debug\ErrorException; 
    1716use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; 
    1817use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; 
     
    9190    { 
    9291        $request = new Request(); 
    93         $exception = new ErrorException('foo'); 
     92        $exception = new \Exception('foo'); 
    9493        $event = new GetResponseForExceptionEvent(new TestKernel(), $request, 'foo', $exception); 
    9594        $event2 = new GetResponseForExceptionEvent(new TestKernelThatThrowsException(), $request, 'foo', $exception);