File monitor: Difference between revisions

From Hegemon Wiki
Jump to navigation Jump to search
Line 8: Line 8:


==Requirements==
==Requirements==
- Must support cancelable shell command
* Must support cancelable shell command.
- Functions/GoRoutines can't be canceled
* Functions/GoRoutines can't be canceled.
- Different editors have differnt save strategies
* Different editors have differnt save strategies.
- Most changes result in multiple events (touch for example CREAT+CHMOD)
* Most changes result in multiple events (touch for example CREAT+CHMOD).
- Should support a delay (could elivate spamming changes)
* Should support a delay (could stop spamming changes).
* Delay should be reset each time a new action occurs.


Modification time? Might not help if you copy an old file onto a new one...
Modification time? Might not help if you copy an old file onto a new one...

Revision as of 00:14, 10 April 2016

Simplified File Watching Interface

Use cases

  • Watch for source code changes and rerun unit tests
    • Shell command, should be cancelable
    • Needs to be filterable (ie .go, .cpp, .hpp)
  • Watch for kernel/nvidia driver changes and copy to EFI

Requirements

  • Must support cancelable shell command.
  • Functions/GoRoutines can't be canceled.
  • Different editors have differnt save strategies.
  • Most changes result in multiple events (touch for example CREAT+CHMOD).
  • Should support a delay (could stop spamming changes).
  • Delay should be reset each time a new action occurs.

Modification time? Might not help if you copy an old file onto a new one...

fsnotify event examples

touch a

2016/04/09 11:59:47 Event: "/home/hegemon/programming/ansible/a": CREATE
2016/04/09 11:59:47 Event: "/home/hegemon/programming/ansible/a": CHMOD

vim :wq

2016/04/09 12:00:19 Event: "/home/hegemon/programming/ansible/4913": CREATE
2016/04/09 12:00:19 Event: "/home/hegemon/programming/ansible/a": RENAME
2016/04/09 12:00:19 Event: "/home/hegemon/programming/ansible/a": CREATE
2016/04/09 12:00:19 Event: "/home/hegemon/programming/ansible/a": WRITE
2016/04/09 12:00:19 Event: "/home/hegemon/programming/ansible/a": CHMOD

atom (save existing file):

2016/04/09 13:32:59 Event: "/home/hegemon/programming/ansible/a": WRITE
2016/04/09 13:32:59 Event: "/home/hegemon/programming/ansible/a": WRITE


mv b a

2016/04/09 13:31:24 Event: "/home/hegemon/programming/ansible/b": RENAME
2016/04/09 13:31:24 Event: "/home/hegemon/programming/ansible/a": CREATE