Skip to content

Reload extra files in the current directory with inotify #3377

@davegaeddert

Description

@davegaeddert

It seems that adding an extra watch file in the current directory, like .env, will cause inotify to crash because the os.path.dirname(".env") == "". Using ./.env works though (dirname is then .) or an absolute path works too.

def add_extra_file(self, filename):
dirname = os.path.dirname(filename)
if dirname in self._dirs:
return
self._watcher.add_watch(dirname, mask=self.event_mask)
self._dirs.add(dirname)

Curious what you think? If this is something that should be allowed, then I wonder if you could just do something like this to protect against it:

if not dirname:
    dirname = "."

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions