Skip to content

Commit

Permalink
fix(rpp.browser): update process termination command and handle speci…
Browse files Browse the repository at this point in the history
…al cases
  • Loading branch information
manucabral committed Nov 4, 2024
1 parent c260b4e commit 52d82ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rpp/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self):
self.name: str = self.get_name()
self.process: str = self.path.split("\\")[-1]
self.log.info("Initialized.")
self.executor = subprocess.run

def get_progid(self) -> str:
"""
Expand Down Expand Up @@ -88,7 +89,7 @@ def kill(self, admin: bool = False) -> None:
"Start-Process",
"powershell",
"-ArgumentList",
f"Stop-Process -Name '{self.process.replace('.exe', '')}' -Force",
f"\"Stop-Process -Name '{self.process.replace(".exe", "")}' -Force\"",
"-Verb",
"RunAs",
]
Expand Down Expand Up @@ -198,7 +199,8 @@ def as_admin():
text=True,
)
self.log.info("Started with PID: %s (%s)", process.pid, self.process)
if self.process != "opera.exe":
special_cases = ["Arc.exe"]
if self.process in special_cases:
_, stderr = process.communicate()
result = stderr.strip()
if "Access is denied" in result:
Expand Down

0 comments on commit 52d82ff

Please sign in to comment.