Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/dotenv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def dotenv_values(

def _is_file_or_fifo(path: StrPath) -> bool:
"""
Return True if `path` exists and is either a regular file or a FIFO.
Return True if `path` exists and is either a regular file, a FIFO, or a character device.
"""
if os.path.isfile(path):
return True
Expand All @@ -529,4 +529,4 @@ def _is_file_or_fifo(path: StrPath) -> bool:
except (FileNotFoundError, OSError):
return False

return stat.S_ISFIFO(st.st_mode)
return stat.S_ISFIFO(st.st_mode) or stat.S_ISCHR(st.st_mode)
9 changes: 9 additions & 0 deletions tests/test_fifo_dotenv.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import os
import pathlib
import sys
Expand Down Expand Up @@ -29,3 +30,11 @@ def writer():

assert ok is True
assert os.getenv("MY_PASSWORD") == "pipe-secret"


def test_load_dotenv_from_devnull(caplog):
with caplog.at_level(logging.INFO):
ok = load_dotenv(dotenv_path=os.devnull, verbose=True)

assert ok is False
assert "could not find configuration file" not in caplog.text
Loading