glastree_on_gitea
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Pao\Drivers;
|
||||
|
||||
use Laravel\Pao\Contracts\Driver;
|
||||
use Laravel\Pao\Execution;
|
||||
use Laravel\Pao\UserFilters\CaptureFilter;
|
||||
use Laravel\Pao\UserFilters\NullFilter;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
abstract class Starter implements Driver
|
||||
{
|
||||
protected function registerNullFilter(): void
|
||||
{
|
||||
if (! in_array('agent_output_null', stream_get_filters(), true)) {
|
||||
stream_filter_register('agent_output_null', NullFilter::class);
|
||||
}
|
||||
}
|
||||
|
||||
protected function silenceStdout(): void
|
||||
{
|
||||
if (! in_array('agent_output_capture', stream_get_filters(), true)) {
|
||||
stream_filter_register('agent_output_capture', CaptureFilter::class);
|
||||
}
|
||||
|
||||
CaptureFilter::reset();
|
||||
|
||||
$execution = Execution::current();
|
||||
|
||||
$execution->filter = stream_filter_append(STDOUT, 'agent_output_capture', STREAM_FILTER_WRITE) ?: null;
|
||||
}
|
||||
|
||||
protected function silenceStderr(): void
|
||||
{
|
||||
stream_filter_append(STDERR, 'agent_output_null', STREAM_FILTER_WRITE);
|
||||
}
|
||||
|
||||
protected function saveStdout(): void
|
||||
{
|
||||
$execution = Execution::current();
|
||||
|
||||
$execution->stdout = fopen('php://stdout', 'w') ?: STDOUT;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user