mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-07 13:15:00 +00:00
refactor: rename and simplify parent process name retrieval function
This commit is contained in:
parent
cb42464676
commit
e5ff5eff75
1 changed files with 2 additions and 3 deletions
|
@ -6,7 +6,6 @@ import sys
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
import pexpect
|
import pexpect
|
||||||
import psutil
|
|
||||||
|
|
||||||
|
|
||||||
def run_cmd(command, verbose=False, error_print=None):
|
def run_cmd(command, verbose=False, error_print=None):
|
||||||
|
@ -24,7 +23,7 @@ def run_cmd(command, verbose=False, error_print=None):
|
||||||
return 1, error_message
|
return 1, error_message
|
||||||
|
|
||||||
|
|
||||||
def get_parent_process_name():
|
def get_windows_parent_process_name():
|
||||||
try:
|
try:
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
kernel32 = ctypes.windll.kernel32
|
kernel32 = ctypes.windll.kernel32
|
||||||
|
@ -37,7 +36,7 @@ def get_parent_process_name():
|
||||||
return os.path.basename(exe_path.value).lower()
|
return os.path.basename(exe_path.value).lower()
|
||||||
else:
|
else:
|
||||||
return psutil.Process(os.getppid()).name().lower()
|
return psutil.Process(os.getppid()).name().lower()
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue