add Process component

这个提交包含在:
Simon Vieille 2019-04-24 12:26:25 +02:00
父节点 c60d40fe83
当前提交 356837b136
签署人:: deblan
GPG 密钥 ID: 03383D15A1D31745
共有 2 个文件被更改,包括 13 次插入2 次删除

查看文件

@ -5,6 +5,7 @@
}
},
"require": {
"symfony/console": "^4.2"
"symfony/console": "^4.2",
"symfony/process": "^4.2"
}
}

查看文件

@ -7,6 +7,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Command\Command as BaseCommand;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Process\Process;
/**
* class CheckCommand.
@ -83,7 +84,16 @@ class CheckCommand extends BaseCommand
protected function check($domain)
{
$whois = shell_exec(sprintf('whois %s', escapeshellarg($domain)));
$process = new Process(['whois', $domain]);
$process->run();
if (!$process->isSuccessful()) {
$this->fails[] = [$domain, 'FAIL'];
return;
}
$whois = $process->getOutput();
preg_match('/Expiry Date: ([^\s]+)/i', $whois, $match);