MCPcopy Index your code
hub / github.com/python/cpython / send_signal

Method send_signal

Lib/subprocess.py:1740–1752  ·  view source on GitHub ↗

Send a signal to the process.

(self, sig)

Source from the content-addressed store, hash-verified

1738 return (stdout, stderr)
1739
1740 def send_signal(self, sig):
1741 """Send a signal to the process."""
1742 # Don't signal a process that we know has already died.
1743 if self.returncode is not None:
1744 return
1745 if sig == signal.SIGTERM:
1746 self.terminate()
1747 elif sig == signal.CTRL_C_EVENT:
1748 os.kill(self.pid, signal.CTRL_C_EVENT)
1749 elif sig == signal.CTRL_BREAK_EVENT:
1750 os.kill(self.pid, signal.CTRL_BREAK_EVENT)
1751 else:
1752 raise ValueError("Unsupported signal: {}".format(sig))
1753
1754 def terminate(self):
1755 """Terminates the process."""

Callers 4

terminateMethod · 0.95
killMethod · 0.95
test_send_signal_raceMethod · 0.95

Calls 4

terminateMethod · 0.95
pollMethod · 0.95
killMethod · 0.45
formatMethod · 0.45

Tested by 2

test_send_signal_raceMethod · 0.76