MCPcopy
hub / github.com/Gallopsled/pwntools / close

Method close

pwnlib/tubes/process.py:799–822  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

797 return self.proc.stdout and not self.proc.stdout.closed
798
799 def close(self):
800 if self.proc is None:
801 return
802
803 # First check if we are already dead
804 self.poll()
805
806 if not self._stop_noticed:
807 try:
808 self.proc.kill()
809 self.proc.wait()
810 self._stop_noticed = time.time()
811 self.info('Stopped process %r (pid %i)' % (self.program, self.pid))
812 except OSError:
813 pass
814
815 # close file descriptors
816 for fd in [self.proc.stdin, self.proc.stdout, self.proc.stderr]:
817 if fd is not None:
818 try:
819 fd.close()
820 except IOError as e:
821 if e.errno != errno.EPIPE and e.errno != errno.EINVAL:
822 raise
823
824
825 def fileno(self):

Callers 4

killMethod · 0.95
shutdown_rawMethod · 0.95
__init__Method · 0.45

Calls 4

pollMethod · 0.95
infoMethod · 0.80
killMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected