mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Implement a simplified xargs in python
This commit is contained in:
parent
a5b56bd9e3
commit
b7d395410b
13 changed files with 130 additions and 62 deletions
|
|
@ -12,18 +12,3 @@ def environment_dir(ENVIRONMENT_DIR, language_version):
|
|||
return None
|
||||
else:
|
||||
return '{0}-{1}'.format(ENVIRONMENT_DIR, language_version)
|
||||
|
||||
|
||||
def file_args_to_stdin(file_args):
|
||||
return '\0'.join(list(file_args) + [''])
|
||||
|
||||
|
||||
def run_hook(cmd_args, file_args):
|
||||
return cmd_output(
|
||||
# Use -s 4000 (slightly less than posix mandated minimum)
|
||||
# This is to prevent "xargs: ... Bad file number" on windows
|
||||
'xargs', '-0', '-s4000', *cmd_args,
|
||||
stdin=file_args_to_stdin(file_args),
|
||||
retcode=None,
|
||||
encoding=None
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue