mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Quote args in venv'd languages
This commit is contained in:
parent
9fc6a8bfed
commit
f4d251fbbe
3 changed files with 24 additions and 2 deletions
|
|
@ -1,13 +1,16 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import pipes
|
||||
|
||||
|
||||
def file_args_to_stdin(file_args):
|
||||
return '\0'.join(list(file_args) + [''])
|
||||
|
||||
|
||||
def run_hook(env, hook, file_args):
|
||||
quoted_args = [pipes.quote(arg) for arg in hook['args']]
|
||||
return env.run(
|
||||
' '.join(['xargs', '-0', hook['entry']] + hook['args']),
|
||||
' '.join(['xargs', '-0', hook['entry']] + quoted_args),
|
||||
stdin=file_args_to_stdin(file_args),
|
||||
retcode=None,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue