MCPcopy Create free account
hub / github.com/pexpect/pexpect / close

Method close

pexpect/socket_pexpect.py:68–81  ·  view source on GitHub ↗

Close the socket. Calling this method a second time does nothing, but if the file descriptor was closed elsewhere, :class:`OSError` will be raised.

(self)

Source from the content-addressed store, hash-verified

66 self.use_poll = use_poll
67
68 def close(self):
69 """Close the socket.
70
71 Calling this method a second time does nothing, but if the file
72 descriptor was closed elsewhere, :class:`OSError` will be raised.
73 """
74 if self.child_fd == -1:
75 return
76
77 self.flush()
78 self.socket.shutdown(socket.SHUT_RDWR)
79 self.socket.close()
80 self.child_fd = -1
81 self.closed = True
82
83 def isalive(self):
84 """ Alive if the fileno is valid """

Callers 2

test_socket_isaliveMethod · 0.95
test_socket_isattyMethod · 0.95

Calls 1

flushMethod · 0.45

Tested by 2

test_socket_isaliveMethod · 0.76
test_socket_isattyMethod · 0.76