Skip to content
Permalink
Browse files

Added dataAvailable method for ConsoleInput

  • Loading branch information...
Rik van der Heijden
Rik van der Heijden committed Dec 12, 2012
1 parent ccde7e8 commit 060f0905289f9b1a34ade147ecb6a2f4371bd810
Showing with 12 additions and 0 deletions.
  1. +12 −0 lib/Cake/Console/ConsoleInput.php
@@ -50,4 +50,16 @@ public function read() {
return fgets($this->_input);
}
/**
* Check if data is available on stdin
*
* @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, $w = null, $e = null, $timeout);
return ($readyFds > 0)
}
}

0 comments on commit 060f090

Please sign in to comment.
You can’t perform that action at this time.