mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 09:04:41 +04:00
assert that the pre-commit script being executed is not the legacy
This commit is contained in:
parent
cd61269389
commit
ec72cb7260
1 changed files with 2 additions and 1 deletions
|
|
@ -57,7 +57,8 @@ def _run_legacy():
|
||||||
legacy_script = HOOK_TYPE + '.legacy'
|
legacy_script = HOOK_TYPE + '.legacy'
|
||||||
is_legacy_executed = os.path.basename(__file__) == legacy_script
|
is_legacy_executed = os.path.basename(__file__) == legacy_script
|
||||||
legacy_hook = os.path.join(HERE, legacy_script)
|
legacy_hook = os.path.join(HERE, legacy_script)
|
||||||
if not is_legacy_executed and os.access(legacy_hook, os.X_OK):
|
assert not is_legacy_executed, __file__
|
||||||
|
if os.access(legacy_hook, os.X_OK):
|
||||||
cmd = _norm_exe(legacy_hook) + (legacy_hook,) + tuple(sys.argv[1:])
|
cmd = _norm_exe(legacy_hook) + (legacy_hook,) + tuple(sys.argv[1:])
|
||||||
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE if stdin else None)
|
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE if stdin else None)
|
||||||
proc.communicate(stdin)
|
proc.communicate(stdin)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue