| 1 | import os |
| 2 | |
| 3 | os.find_abs_path_of_executable('inotifywait') or { |
| 4 | eprintln('This program uses the inotifywait executable, which is missing.') |
| 5 | exit(1) |
| 6 | } |
| 7 | mut cmd := os.start_new_command('inotifywait -q -r -m -e move,modify,create,delete .')! |
| 8 | defer { cmd.close() or {} } |
| 9 | for !cmd.eof { |
| 10 | line := cmd.read_line() |
| 11 | if line == '' && cmd.eof { |
| 12 | continue |
| 13 | } |
| 14 | eprintln('> notification: ${line}') |
| 15 | } |
| 16 |