Changeset 32432
- Timestamp:
- 04/01/11 18:15:27 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2.0/src/Symfony/Component/Process/Process.php
r32364 r32432 71 71 * from the independent process during execution. 72 72 * 73 * If you don't provide a callback, the STDOUT and STDERR are available only after74 * the process is finishedvia 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. 75 75 * 76 76 * @param Closure|string|array $callback A PHP callback to run whenever there is some … … 85 85 public function run($callback = null) 86 86 { 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 }; 100 102 101 103 $descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')); branches/2.0/tests/Symfony/Tests/Component/HttpKernel/Debug/ExceptionListenerTest.php
r32299 r32432 14 14 use Symfony\Component\HttpKernel\HttpKernelInterface; 15 15 use Symfony\Component\HttpKernel\Debug\ExceptionListener; 16 use Symfony\Component\HttpKernel\Debug\ErrorException;17 16 use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; 18 17 use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; … … 91 90 { 92 91 $request = new Request(); 93 $exception = new ErrorException('foo');92 $exception = new \Exception('foo'); 94 93 $event = new GetResponseForExceptionEvent(new TestKernel(), $request, 'foo', $exception); 95 94 $event2 = new GetResponseForExceptionEvent(new TestKernelThatThrowsException(), $request, 'foo', $exception);