Skip to content

Commit 14b103b

Browse files
authored
Enable execution in Docker environments (#19)
1 parent 8ca5562 commit 14b103b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

html2print/html2print.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ def create_webdriver(chromedriver: Optional[str], path_to_cache_dir: str):
312312
webdriver_options.add_argument("--headless")
313313
webdriver_options.add_argument("--disable-extensions")
314314

315+
# The Chrome option --disable-dev-shm-usage disables the use of /dev/shm
316+
# (shared memory) for temporary storage in Chrome.
317+
# By default, Chrome uses /dev/shm for storing temporary files to improve
318+
# performance. However, in environments with limited shared memory (such as
319+
# Docker containers), this can lead to crashes or issues due to insufficient
320+
# space.
321+
webdriver_options.add_argument("--disable-dev-shm-usage")
322+
315323
webdriver_options.add_experimental_option("useAutomationExtension", False)
316324
webdriver_options.add_experimental_option(
317325
"excludeSwitches", ["enable-automation"]

0 commit comments

Comments
 (0)