/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
common/shell/Runners/Proc.php
46 строк
895 B
Developer
Initial commit
03 авг 2026, 17:43
03 авг 2026, 17:43
7433917
Код
Авторство
О чём код?
<?php declare(strict_types=1); namespace common\shell\Runners; use common\shell\Commands\CommandInterface; class Proc implements Runner, ReturnValue, StandardOut, StandardError { private false|string $stdout; private false|string $stderr; private int $returnValue; private array $descriptorSpec = [ 1 => ['pipe', 'w'], 2 => ['pipe', 'w'], ]; public function run(CommandInterface $command) { $process = proc_open((string)$command, $this->descriptorSpec, $pipes); $this->stdout = stream_get_contents($pipes[1]); $this->stderr = stream_get_contents($pipes[2]); $this->returnValue = proc_close($process); return null; } public function getReturnValue(): int { return $this->returnValue; } public function getStandardOut(): false|string { return $this->stdout; } public function getStandardError(): false|string { return $this->stderr; } }