mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-13 03:39:29 -06:00
xargs returns nonzero for negate + not found exe (fixes pcre + not found #447)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user