Add timeout option on binary load
This commit is contained in:
parent
f623bb9107
commit
0567c42f07
1 changed files with 5 additions and 3 deletions
|
|
@ -40,7 +40,7 @@ abstract class Binary implements AdapterInterface
|
||||||
*
|
*
|
||||||
* @param type $binary The path file to the binary
|
* @param type $binary The path file to the binary
|
||||||
* @param Logger $logger A logger
|
* @param Logger $logger A logger
|
||||||
* @param Integer $timeout The timout for the underlying process
|
* @param Integer $timeout The timout for the underlying process, 0 means no timeout
|
||||||
*/
|
*/
|
||||||
public function __construct($binary, Logger $logger, $timeout = 60)
|
public function __construct($binary, Logger $logger, $timeout = 60)
|
||||||
{
|
{
|
||||||
|
|
@ -65,11 +65,13 @@ abstract class Binary implements AdapterInterface
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*
|
*
|
||||||
* @param Logger $logger A logger
|
* @param Logger $logger A logger
|
||||||
|
* @param Integer $timeout The timout for the underlying process, 0 means no timeout
|
||||||
|
*
|
||||||
* @return Binary The binary
|
* @return Binary The binary
|
||||||
*
|
*
|
||||||
* @throws Exception\BinaryNotFoundException
|
* @throws Exception\BinaryNotFoundException
|
||||||
*/
|
*/
|
||||||
public static function load(Logger $logger)
|
public static function load(Logger $logger, $timeout = 60)
|
||||||
{
|
{
|
||||||
$finder = new ExecutableFinder();
|
$finder = new ExecutableFinder();
|
||||||
$binary = null;
|
$binary = null;
|
||||||
|
|
@ -84,7 +86,7 @@ abstract class Binary implements AdapterInterface
|
||||||
throw new BinaryNotFoundException('Binary not found');
|
throw new BinaryNotFoundException('Binary not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return new static($binary, $logger);
|
return new static($binary, $logger, $timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue