MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __exit__

Method __exit__

tools/python-3.11.9-amd64/Lib/subprocess.py:1092–1118  ·  view source on GitHub ↗
(self, exc_type, value, traceback)

Source from the content-addressed store, hash-verified

1090 return self
1091
1092 def __exit__(self, exc_type, value, traceback):
1093 if self.stdout:
1094 self.stdout.close()
1095 if self.stderr:
1096 self.stderr.close()
1097 try: # Flushing a BufferedWriter may raise an error
1098 if self.stdin:
1099 self.stdin.close()
1100 finally:
1101 if exc_type == KeyboardInterrupt:
1102 # https://bugs.python.org/issue25942
1103 # In the case of a KeyboardInterrupt we assume the SIGINT
1104 # was also already sent to our child processes. We can't
1105 # block indefinitely as that is not user friendly.
1106 # If we have not already waited a brief amount of time in
1107 # an interrupted .wait() or .communicate() call, do so here
1108 # for consistency.
1109 if self._sigint_wait_secs > 0:
1110 try:
1111 self._wait(timeout=self._sigint_wait_secs)
1112 except TimeoutExpired:
1113 pass
1114 self._sigint_wait_secs = 0 # Note that this has been done.
1115 return # resume the KeyboardInterrupt
1116
1117 # Wait for the process to terminate, to avoid zombies.
1118 self.wait()
1119
1120 def __del__(self, _maxsize=sys.maxsize, _warn=warnings.warn):
1121 if not self._child_created:

Callers

nothing calls this directly

Calls 3

_waitMethod · 0.95
waitMethod · 0.95
closeMethod · 0.45

Tested by

no test coverage detected