Skip to content

Commit 0411028

Browse files
committed
Add override for temp directory path
1 parent 786439a commit 0411028

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

choreographer/browser.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def __init__(
6161
# Configuration
6262
self.enable_gpu = kwargs.pop("enable_gpu", False)
6363
self.enable_sandbox = kwargs.pop("enable_sandbox", False)
64+
self._tmpdir_path = kwargs.pop("tmp_path", None)
6465
if len(kwargs):
6566
raise ValueError(f"Unknown keyword arguments: {kwargs}")
6667
self.headless = headless
@@ -92,8 +93,11 @@ def __init__(
9293
raise BrowserFailedError(
9394
"Could not find an acceptable browser. Please set environmental variable BROWSER_PATH or pass `path=/path/to/browser` into the Browser() constructor."
9495
)
95-
if path.contains("snap"):
96-
self._snap = True
96+
97+
if self._tmpdir_path:
98+
temp_args = dict(dir=self._tmpdir_path)
99+
elif path.contains("snap"):
100+
self._tmpdir_path = Path.home()
97101
if self.debug:
98102
print("Snap detected, moving tmp directory to home", file=sys.stderr)
99103
temp_args = dict(prefix=".choreographer-", dir=Path.home())

0 commit comments

Comments
 (0)