Files
gitea-sync-ai/app/file_watcher.py
T
2026-08-03 17:23:50 +02:00

24 lines
542 B
Python

import subprocess
from pathlib import Path
def start_inotify_watcher(path: str, callback=None):
"""
Startet einen Inotify-Watcher mit dem Befehl 'inotifywait'.
Callback wird aufgerufen bei Dateiänderungen.
"""
# Useinotifywait from inotify-tools package
command = [
"inotifywait",
"-m", "-r", "--format '%w%f %e'",
str(path)
]
process = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True
)
return process