when-changed icon indicating copy to clipboard operation
when-changed copied to clipboard

On created event not correctly handled on linux

Open eviweb opened this issue 6 years ago • 4 comments

Hi, the following code taken from the on_created event handler:

if self.observer.__class__.__name__ == 'InotifyObserver':
            # inotify also generates modified events for created files
            return

prevents the on_change method to be called on on_created events.

This appears more as a semantic issue as the on_modified handler seems to do the job for now.
But just partially in fact, because this is the source of the issue #68.
And it would take more importance regarding the issue #58 which implies to distinguish event types.
I think being able to propose an alternative soon. best regards

eviweb avatar Mar 27 '19 08:03 eviweb

Ah yes, the issue with inotify is that it generates multiple events for something we want to handle as one event. It would be good to map out exactly which events are triggered for what situations (file creation, file moved to directory, file modified, file deleted, etc). I'm fairly certain the behavior is different across platforms as well. I don't think watchdog is completely platform agnostic...

joh avatar Mar 27 '19 08:03 joh

I think it's possible to deal with this issue by keeping track of the last event type. I prefer working on this once the PR #75 will be merged as it adds a new event handler.

eviweb avatar Mar 27 '19 09:03 eviweb

addressed by #77

eviweb avatar Mar 27 '19 10:03 eviweb

Better choice I think, please see my comment here: https://github.com/joh/when-changed/pull/77#discussion_r269607586

eviweb avatar Mar 27 '19 16:03 eviweb