*/
abstract class AbstractPipes implements PipesInterface
{
- /** @var array */
public $pipes = array();
- /** @var string */
private $inputBuffer = '';
- /** @var resource|scalar|\Iterator|null */
private $input;
- /** @var bool */
private $blocked = true;
+ private $lastError;
+ /**
+ * @param resource|string|int|float|bool|\Iterator|null $input
+ */
public function __construct($input)
{
if (is_resource($input) || $input instanceof \Iterator) {
*/
protected function hasSystemCallBeenInterrupted()
{
- $lastError = error_get_last();
+ $lastError = $this->lastError;
+ $this->lastError = null;
// stream_select returns false when the `select` system call is interrupted by an incoming signal
- return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
+ return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
}
/**
$w = array($this->pipes[0]);
// let's have a look if something changed in streams
- if (false === $n = @stream_select($r, $w, $e, 0, 0)) {
+ if (false === @stream_select($r, $w, $e, 0, 0)) {
return;
}
return array($this->pipes[0]);
}
}
+
+ /**
+ * @internal
+ */
+ public function handleError($type, $msg)
+ {
+ $this->lastError = $msg;
+ }
}