for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Uxmp\Core\Component\Io\Lib;
/**
* Wraps php popen-command as it is tricky to test
*/
final class PopenWrapper implements PopenWrapperInterface
{
* Runs a shell command
*
* If the execution succeeds, the resource will be closed on shutdown
* @param string $command Command to execute (ensure the arguments get escaped correctly!)
* @return resource|null
* @codeCoverageIgnore
public function run(string $command): mixed
$handle = popen('nice -n 19 '.$command, 'r');
if ($handle === false) {
return null;
}
register_shutdown_function(static fn () => fclose($handle));
return $handle;