mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
xargs returns nonzero for negate + not found exe (fixes pcre + not found #447)
This commit is contained in:
parent
0e2c3c1ff9
commit
a157e1a63f
7 changed files with 49 additions and 11 deletions
|
|
@ -1,11 +1,12 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from sys import platform
|
||||
import sys
|
||||
|
||||
from pre_commit.xargs import xargs
|
||||
|
||||
|
||||
ENVIRONMENT_DIR = None
|
||||
GREP = 'ggrep' if sys.platform == 'darwin' else 'grep'
|
||||
|
||||
|
||||
def install_environment(
|
||||
|
|
@ -19,10 +20,7 @@ def install_environment(
|
|||
|
||||
def run_hook(repo_cmd_runner, hook, file_args):
|
||||
# For PCRE the entry is the regular expression to match
|
||||
cmd = (
|
||||
'ggrep' if platform == 'darwin' else 'grep',
|
||||
'-H', '-n', '-P',
|
||||
) + tuple(hook['args']) + (hook['entry'],)
|
||||
cmd = (GREP, '-H', '-n', '-P') + tuple(hook['args']) + (hook['entry'],)
|
||||
|
||||
# Grep usually returns 0 for matches, and nonzero for non-matches so we
|
||||
# negate it here.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue