Skip to content

Commit

Permalink
fix windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 committed Jun 29, 2024
1 parent e0d6de5 commit dc4924a
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions Lib/asyncio/base_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import warnings
import os
import signal
import sys

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

def send_signal(self, signal):
self._check_proc()
try:
os.kill(self._proc.pid, signal)
except ProcessLookupError:
pass
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 terminate(self):
self.send_signal(signal.SIGTERM)
def terminate(self):
self.send_signal(signal.SIGTERM)

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

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

0 comments on commit dc4924a

Please sign in to comment.