MCPcopy Create free account
hub / github.com/microsoft/debugpy / wait_for_exit

Function wait_for_exit

src/debugpy/launcher/debuggee.py:196–227  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

194
195
196def wait_for_exit():
197 try:
198 code = process.wait()
199 if sys.platform != "win32" and code < 0:
200 # On POSIX, if the process was terminated by a signal, Popen will use
201 # a negative returncode to indicate that - but the actual exit code of
202 # the process is always an unsigned number, and can be determined by
203 # taking the lowest 8 bits of that negative returncode.
204 code &= 0xFF
205 except Exception:
206 log.swallow_exception("Couldn't determine process exit code")
207 code = -1
208
209 log.info("{0} exited with code {1}", describe(), code)
210 output.wait_for_remaining_output()
211
212 # Determine whether we should wait or not before sending "exited", so that any
213 # follow-up "terminate" requests don't affect the predicates.
214 should_wait = any(pred(code) for pred in wait_on_exit_predicates)
215
216 try:
217 launcher.channel.send_event("exited", {"exitCode": code})
218 except Exception:
219 pass
220
221 if should_wait:
222 _wait_for_user_input()
223
224 try:
225 launcher.channel.send_event("terminated")
226 except Exception:
227 pass
228
229
230def _wait_for_user_input():

Callers

nothing calls this directly

Calls 5

describeFunction · 0.85
_wait_for_user_inputFunction · 0.85
infoMethod · 0.80
send_eventMethod · 0.80
waitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…