From 42000c452169e873aa29ce071db4b3fcad2c8d84 Mon Sep 17 00:00:00 2001 From: Alex Hutton Date: Fri, 10 Feb 2017 18:09:00 +1100 Subject: [PATCH] Fix eslint on windows - The bare exe was the first filename attempted to match, this changes means it will be matched last, allowing other files to be matched if they exist. The result is that eslint now works on Windows. --- pre_commit/parse_shebang.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pre_commit/parse_shebang.py b/pre_commit/parse_shebang.py index 122750ae..be38d15f 100644 --- a/pre_commit/parse_shebang.py +++ b/pre_commit/parse_shebang.py @@ -53,9 +53,10 @@ def find_executable(exe, _environ=None): environ = _environ if _environ is not None else os.environ if 'PATHEXT' in environ: - possible_exe_names = (exe,) + tuple( + possible_exe_names = tuple( exe + ext.lower() for ext in environ['PATHEXT'].split(os.pathsep) - ) + ) + (exe,) + else: possible_exe_names = (exe,)