Skip to content

Commit

Permalink
Partially revert "pythongh-87744: fix waitpid race while calling send…
Browse files Browse the repository at this point in the history
…_signal in asyncio (python#121126)"

This reverts the non-test changes of commit bd473aa.
  • Loading branch information
gschaffner committed Nov 19, 2024
1 parent d6b3e78 commit a50f0b8
Showing 1 changed file with 9 additions and 26 deletions.
35 changes: 9 additions & 26 deletions Lib/asyncio/base_subprocess.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import collections
import subprocess
import warnings
import os
import signal
import sys

from . import protocols
from . import transports
Expand Down Expand Up @@ -145,31 +142,17 @@ def _check_proc(self):
if self._proc is None:
raise ProcessLookupError()

if sys.platform == 'win32':
def send_signal(self, signal):
self._check_proc()
self._proc.send_signal(signal)

def terminate(self):
self._check_proc()
self._proc.terminate()

def kill(self):
self._check_proc()
self._proc.kill()
else:
def send_signal(self, signal):
self._check_proc()
try:
os.kill(self._proc.pid, signal)
except ProcessLookupError:
pass
def send_signal(self, signal):
self._check_proc()
self._proc.send_signal(signal)

def terminate(self):
self.send_signal(signal.SIGTERM)
def terminate(self):
self._check_proc()
self._proc.terminate()

def kill(self):
self.send_signal(signal.SIGKILL)
def kill(self):
self._check_proc()
self._proc.kill()

async def _connect_pipes(self, waiter):
try:
Expand Down

0 comments on commit a50f0b8

Please sign in to comment.