Skip to content

Don't terminate process if file contents did not change #23

Description

@kevinburke

If I open a file and save it without making any modifications, it would be neat if justrun did not terminate the process. This would help prevent against unnecessary server reloads, also because I compulsively hit :w when I am working with a file in vim.

The implementation might be a little tricky. On Macs, here are the events that get generated when I save a file in TextEdit:

2018/01/05 17:09:13 unignored file change: "/Users/kevin/src/github.com/kevinburke/portfolio/static/dashboard.js": REMOVE
2018/01/05 17:09:13 unignored file change: "/Users/kevin/src/github.com/kevinburke/portfolio/static/dashboard.js": CREATE
2018/01/05 17:09:13 unignored file change: "/Users/kevin/src/github.com/kevinburke/portfolio/static/dashboard.js": CHMOD
2018/01/05 17:09:13 unignored file change: "/Users/kevin/src/github.com/kevinburke/portfolio/static/dashboard.js": CHMOD

So it wouldn't be enough to e.g. check only for single events, since you'd have to wait for the second or third event to determine "the file is still there and didn't change". You could check right after you get the tick.C event if you have the delay turned on.

It would also be slow if a file was particularly large, though you could decide to bail on the "is this actually the same file" strategy after like 4MB or whatever.

See also fsnotify/fsnotify#232, but I'm not sure that's the right place for it.

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