protected function getWatchingResponse($cmd)
{
$result = null;
$nbBytes = $this->write($cmd);
if ($nbBytes && $nbBytes > 0) {
$response = $this->read($nbBytes);
$matches = [];
if (!preg_match('#^WATCHING (\\d+).*?#', $response, $matches)) {
throw new \RuntimeException(sprintf('Unhandled response: %s', $response));
}
$result = $response;
}
return $result;
}