Skip to content

Commit

Permalink
rename no_parallel_processes
Browse files Browse the repository at this point in the history
  • Loading branch information
tamland committed Apr 10, 2014
1 parent 60efd74 commit a839194
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/watchdog/tricks/__init__.py
Expand Up @@ -79,18 +79,18 @@ class ShellCommandTrick(Trick):

def __init__(self, shell_command=None, patterns=None, ignore_patterns=None,
ignore_directories=False, wait_for_process=False,
no_parallel_processes=False):
drop_during_process=False):
super(ShellCommandTrick, self).__init__(patterns, ignore_patterns,
ignore_directories)
self.shell_command = shell_command
self.wait_for_process = wait_for_process
self.no_parallel_processes = no_parallel_processes
self.drop_during_process = drop_during_process
self.process = None

def on_any_event(self, event):
from string import Template
if self.no_parallel_processes and self.process and self.process.poll() is None:

if self.drop_during_process and self.process and self.process.poll() is None:
return

if event.is_directory:
Expand Down
9 changes: 5 additions & 4 deletions src/watchdog/watchmedo.py
Expand Up @@ -412,11 +412,12 @@ def log(args):
action='store_true',
default=False,
help="wait for process to finish to avoid multiple simultaneous instances")
@arg('-n', '--no-parallel',
dest='no_parallel_processes',
@arg('-W', '--drop',
dest='drop_during_process',
action='store_true',
default=False,
help="Ignore events that happen while the previous process is still running")
help="Ignore events that occur while command is still being executed " \
"to avoid multiple simultaneous instances")
def shell_command(args):
"""
Subcommand to execute shell commands in response to file system events.
Expand All @@ -437,7 +438,7 @@ def shell_command(args):
ignore_patterns=ignore_patterns,
ignore_directories=args.ignore_directories,
wait_for_process=args.wait_for_process,
no_parallel_processes=args.no_parallel_processes)
drop_during_process=args.drop_during_process)
observer = Observer(timeout=args.timeout)
observe_with(observer, handler, args.directories, args.recursive)

Expand Down

0 comments on commit a839194

Please sign in to comment.