Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove mandatory cleanup for all current browsers at startup #70

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions botright/botright.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import logging
import os
import shutil
from tempfile import TemporaryDirectory, gettempdir
from tempfile import TemporaryDirectory
from typing import Any, Dict, List, Optional

import browsers
Expand Down Expand Up @@ -88,7 +87,6 @@ async def __ainit__(

# Getting Chromium based browser engine and deleting botright temp dirs
self.browser = self.get_browser_engine()
self.delete_botright_temp_dirs()

# Setting Values
self.headless = headless
Expand Down Expand Up @@ -214,13 +212,3 @@ def get_browser_engine() -> browsers.Browser:
return browser_engine

raise EnvironmentError("No Chromium based browser found")

@staticmethod
def delete_botright_temp_dirs() -> None:
temp_path = gettempdir()

for temp_dir in os.listdir(temp_path):
# Check if the item is a directory and starts with 'botright-'
if os.path.isdir(os.path.join(temp_path, temp_dir)) and temp_dir.startswith("botright-"):
# If it matches, delete the folder and its contents
shutil.rmtree(os.path.join(temp_path, temp_dir))