|
|
@@ -16,6 +16,8 @@ declare(strict_types=1);
|
|
|
*/
|
|
|
namespace Cake\Console;
|
|
|
|
|
|
+use Cake\Console\Exception\ConsoleException;
|
|
|
+
|
|
|
/**
|
|
|
* Object wrapper for interacting with stdin
|
|
|
*/
|
|
|
@@ -80,7 +82,16 @@ class ConsoleInput
|
|
|
$readFds = [$this->_input];
|
|
|
$writeFds = null;
|
|
|
$errorFds = null;
|
|
|
+
|
|
|
+ $error = null;
|
|
|
+ set_error_handler(function (int $code, string $message) use (&$error) {
|
|
|
+ $error = "stream_select failed with code={$code} message={$message}.";
|
|
|
+ });
|
|
|
$readyFds = stream_select($readFds, $writeFds, $errorFds, $timeout);
|
|
|
+ restore_error_handler();
|
|
|
+ if ($error !== null) {
|
|
|
+ throw new ConsoleException($error);
|
|
|
+ }
|
|
|
|
|
|
return $readyFds > 0;
|
|
|
}
|