diff --git a/src/Tempest/Console/src/Components/Interactive/TaskComponent.php b/src/Tempest/Console/src/Components/Interactive/TaskComponent.php index 0342e2b16..3b931c0cb 100644 --- a/src/Tempest/Console/src/Components/Interactive/TaskComponent.php +++ b/src/Tempest/Console/src/Components/Interactive/TaskComponent.php @@ -11,7 +11,6 @@ use Tempest\Console\Components\ComponentState; use Tempest\Console\Components\Concerns\HasErrors; use Tempest\Console\Components\Concerns\HasState; -use Tempest\Console\Components\Renderers\KeyValueRenderer; use Tempest\Console\Components\Renderers\SpinnerRenderer; use Tempest\Console\Components\Renderers\TaskRenderer; use Tempest\Console\InteractiveConsoleComponent; @@ -24,8 +23,6 @@ final class TaskComponent implements InteractiveConsoleComponent use HasErrors; use HasState; - private KeyValueRenderer $keyValue; - private TaskRenderer $renderer; private int $processId; @@ -41,13 +38,10 @@ final class TaskComponent implements InteractiveConsoleComponent private(set) array $extensions = ['pcntl']; public function __construct( - private readonly string $label, + readonly string $label, private null|Process|Closure $handler = null, - private readonly ?string $success = null, - private readonly ?string $failure = null, ) { $this->handler = $this->resolveHandler($handler); - $this->keyValue = new KeyValueRenderer(); $this->renderer = new TaskRenderer(new SpinnerRenderer(), $label); $this->startedAt = hrtime(as_number: true); } @@ -145,15 +139,15 @@ private function executeHandler(): void $log = function (string ...$lines): void { arr($lines) ->flatMap(fn (string $line) => explode("\n", $line)) - ->each(fn (string $line) => fwrite($this->sockets[0], $line)); + ->each(function (string $line): void { + fwrite($this->sockets[0], $line); + }); }; try { exit((int) (($this->handler ?? static fn (): bool => true)($log) === false)); } catch (Throwable) { exit(1); - } finally { - socket_close($conn); } }