本文整理汇总了PHP中Symfony\Component\Process\PhpProcess::setTimeout方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpProcess::setTimeout方法的具体用法?PHP PhpProcess::setTimeout怎么用?PHP PhpProcess::setTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Process\PhpProcess
的用法示例。
在下文中一共展示了PhpProcess::setTimeout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runSubProcessInstaller
public function runSubProcessInstaller()
{
$script = <<<'EOF'
<?php
$_REQUEST['goto'] = 'SilentInstall';
$_REQUEST['cli'] = 'true';
require('install.php');
EOF;
$output = '';
$process = new PhpProcess($script, $this->getPath());
// This will be a long process so we allow up to an hour.
$process->setTimeout(3600);
try {
$process->mustRun(function ($type, $buffer) use(&$output) {
$output .= $buffer;
});
} catch (ProcessFailedException $e) {
throw new InstallerException('The installer sub process failed with the following output:' . PHP_EOL . $e->getMessage());
}
return $output;
}
示例2: __construct
/**
* Constructor.
*
* @param string $script
* @param JobReportManagerInterface $reportManager
*/
public function __construct($script, JobReportManagerInterface $reportManager)
{
$this->process = new PhpProcess($script);
$this->process->setTimeout(null);
$this->reportManager = $reportManager;
}