mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Backported dataAvailable to 2.4
This commit is contained in:
parent
46aabbd6ae
commit
67a2276763
1 changed files with 12 additions and 0 deletions
|
@ -48,4 +48,16 @@ class ConsoleInput {
|
||||||
return fgets($this->_input);
|
return fgets($this->_input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if data is available on the stream
|
||||||
|
*
|
||||||
|
* @param integer $timeout An optional time to wait for data
|
||||||
|
* @return bool True for data available, false otherwise
|
||||||
|
*/
|
||||||
|
public function dataAvailable($timeout = 0) {
|
||||||
|
$readFds = array($this->_input);
|
||||||
|
$readyFds = stream_select($readFds, $writeFds, $errorFds, $timeout);
|
||||||
|
return ($readyFds > 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue