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

Other possible events? #212

Open
sgbotsford opened this issue Sep 7, 2018 · 6 comments
Open

Other possible events? #212

sgbotsford opened this issue Sep 7, 2018 · 6 comments

Comments

@sgbotsford
Copy link

Looking at the event flags, there doesn't seem to be one for file open/close events, and at least the Linux ionotify has this capability.

Also, is there any way to retrieve the name or process number of the program that did the opening?

@emcrisostomo
Copy link
Owner

I'll have a look at inotify's event flags: they may not be all supported and/or updated in the current version.

Also, is there any way to retrieve the name or process number of the program that did the opening?

Nope, at least not portably.

@jchook
Copy link

jchook commented Jan 18, 2019

My main use case is "when I save a file, do something".

Currently fsevents does not satisfy this use case very well.

For example, using Atom editor:

  • --event Updated yields three? of the same event on each save
  • --event AttributeModified yields zero events on save

Comparing this to inotifywait, I have CLOSE_WRITE firing ONCE on each save.

@kuvaldini
Copy link

Hi? Where is the list of all possible events?

@kuvaldini
Copy link

Thanks. grep rules

  enum fsw_event_flag
  {
    NoOp = 0,                     /**< No event has occurred. */
    PlatformSpecific = (1 << 0),  /**< Platform-specific placeholder for event type that cannot currently be mapped. */
    Created = (1 << 1),           /**< An object was created. */
    Updated = (1 << 2),           /**< An object was updated. */
    Removed = (1 << 3),           /**< An object was removed. */
    Renamed = (1 << 4),           /**< An object was renamed. */
    OwnerModified = (1 << 5),     /**< The owner of an object was modified. */
    AttributeModified = (1 << 6), /**< The attributes of an object were modified. */
    MovedFrom = (1 << 7),         /**< An object was moved from this location. */
    MovedTo = (1 << 8),           /**< An object was moved to this location. */
    IsFile = (1 << 9),            /**< The object is a file. */
    IsDir = (1 << 10),            /**< The object is a directory. */
    IsSymLink = (1 << 11),        /**< The object is a symbolic link. */
    Link = (1 << 12),             /**< The link count of an object has changed. */
    Overflow = (1 << 13)          /**< The event queue has overflowed. */
  };

@nyngwang
Copy link

@jchook Did you solve it? If I was modifying my file (without saving it) some events also got triggered. I just want to catch one event: on-save.

@jchook
Copy link

jchook commented Apr 12, 2022

I switched to fsnotify

Edit: there is a CLI called on.

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

No branches or pull requests

5 participants