Ability to `watch_file` despite subsequent error
Author: injustCreated Jul 28, 2026Updated Jul 28, 2026
LabelsFeature
Is your feature request related to a problem? Please describe.
I use this in my Python environment:
watch_file pyproject.toml
uv sync
source_env .venv/bin/activateHowever, sometimes I've messed up my pyproject.toml, and uv sync fails. When that happens, watch_file becomes a no-op. After I fix my pyproject.toml, I need to open a new terminal tab to get direnv to pick up the fixed file.
Describe the solution you'd like
I would like the ability for watch_file to do what it says, even if direnv fails. That way, I can fix the error and avoid needing to open a new terminal tab.
Describe alternatives you've considered
Additional context
Right now, it makes no difference where I place watch_file wrt the other lines. This could be changed so that:
- Placing
watch_filebefore a command would watch the file, even if the command fails - Placing it after the failed command would not watch the file
Source: direnv/direnv