def recv(self, size):
try:<EOL><INDENT>buffer = b"<STR_LIT>"<EOL>start = time.time()<EOL>while len(buffer) < size:<EOL><INDENT>select_timeout = None<EOL>if self.timeout is not None:<EOL><INDENT>elapsed = time.time() - start<EOL>if elapsed >= self.timeout:<EOL><INDENT>raise socket.timeout()<EOL><DEDENT>select_timeout = self.timeout - elapsed<EOL><DEDENT>r, w, x = select([self.process.stdout], [], [], select_timeout)<EOL>if r and r[<NUM_LIT:0>] == self.process.stdout:<EOL><INDENT>buffer += os.read(<EOL>self.process.stdout.fileno(), size - len(buffer)<EOL>)<EOL><DEDENT><DEDENT>return buffer<EOL><DEDENT>except socket.timeout:<EOL><INDENT>if buffer:<EOL><INDENT>return buffer<EOL><DEDENT>raise  <EOL><DEDENT>except IOError as e:<EOL><INDENT>raise ProxyCommandFailure("<STR_LIT:U+0020>".join(self.cmd), e.strerror)<EOL><DEDENT>
Read from the standard output of the forked program.

:param int size: how many chars should be read

:return: the string of bytes read, which may be shorter than requested