Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not run the callback when watchfiles starts up #226

Open
frank-lenormand opened this issue Apr 21, 2023 · 2 comments
Open

Do not run the callback when watchfiles starts up #226

frank-lenormand opened this issue Apr 21, 2023 · 2 comments
Labels

Comments

@frank-lenormand
Copy link

Description

Hi,

It seems that watchfiles runs the given command upon starting up.

This is unexpected to me, as I use the tool to run a shell command when the watched files are modified.

Example Code

$ mkdir /tmp/t
$ cd /tmp/t
$ watchfiles 'echo OK' .


### Watchfiles Output

```Text
[11:20:56] watchfiles v0.19.0 👀  path="/tmp/t" target="echo OK" (command) filter=DefaultFilter...
OK


### Operating System & Architecture

Linux-5.15.0-69-generic-x86_64-with-Ubuntu-20.04-focal
#76~20.04.1-Ubuntu SMP Mon Mar 20 15:54:19 UTC 2023


### Environment

_No response_

### Python & Watchfiles Version

python: 3.8.10 (default, Mar 13 2023, 10:26:41)  [GCC 9.4.0], watchfiles: 0.19.0

### Rust & Cargo Version

_No response_
@fritzo
Copy link

fritzo commented May 30, 2023

It would be great if this were controllable, or if EXISTS_ON_INIT were a separate event type users like @frank-lenormand could filter out. OTOH it's helpful in some applications to get all files that exist and also get future changes to them, as it's tricky to orchestrate the directory walking and then get change events.

@frank-lenormand
Copy link
Author

For reference, here is the list of events that inotifywatch supports:

https://github.com/inotify-tools/inotify-tools/blob/master/man/inotifywatch.1.in#L182

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants