diff --git a/src/watchdog/watchmedo.py b/src/watchdog/watchmedo.py index 27a1bf12b..ce891f83b 100755 --- a/src/watchdog/watchmedo.py +++ b/src/watchdog/watchmedo.py @@ -418,6 +418,9 @@ def log(args): default=False, help="Ignore events that occur while command is still being executed " \ "to avoid multiple simultaneous instances") +@arg('--debug-force-polling', + default=False, + help='[debug] forces polling') @expects_obj def shell_command(args): """ @@ -426,12 +429,16 @@ def shell_command(args): :param args: Command line argument options. """ - from watchdog.observers import Observer from watchdog.tricks import ShellCommandTrick if not args.command: args.command = None + if args.debug_force_polling: + from watchdog.observers.polling import PollingObserver as Observer + else: + from watchdog.observers import Observer + patterns, ignore_patterns = parse_patterns(args.patterns, args.ignore_patterns) handler = ShellCommandTrick(shell_command=args.command,