Skip to content

Commit

Permalink
Merge pull request gorakhargosh#336 from mafrosis/shell-command-polling
Browse files Browse the repository at this point in the history
Add --debug-force-polling to shell-command
  • Loading branch information
tamland committed Oct 26, 2015
2 parents 0a05839 + 1bc323c commit c541fbc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/watchdog/watchmedo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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,
Expand Down

0 comments on commit c541fbc

Please sign in to comment.