mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-25 18:39:16 -06:00
Performance hack
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
|
||||
from plumbum import local
|
||||
import subprocess
|
||||
|
||||
PY_ENV = 'py_env'
|
||||
|
||||
@@ -17,21 +16,9 @@ def install_environment():
|
||||
|
||||
|
||||
def run_hook(hook, file_args):
|
||||
# TODO: batch filenames
|
||||
process = subprocess.Popen(
|
||||
['bash', '-c', ' '.join(
|
||||
['source {0}/bin/activate &&'.format(PY_ENV)] +
|
||||
[hook['entry']] + hook.get('args', []) + list(file_args)
|
||||
)],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
)
|
||||
ret = process.communicate()
|
||||
|
||||
return (process.returncode,) + ret
|
||||
|
||||
return local['bash'][
|
||||
'-c', ' '.join(
|
||||
['source {0}/bin/activate &&'.format(PY_ENV)] +
|
||||
[hook['entry']] + hook.get('args', []) + list(file_args)
|
||||
)
|
||||
].run()
|
||||
].run()
|
||||
|
||||
Reference in New Issue
Block a user