Skip to content

Commit

Permalink
Handle backslash escaping in Windows for path regex.
Browse files Browse the repository at this point in the history
  • Loading branch information
mblayman committed Dec 26, 2021
1 parent 7acdae2 commit 3fed3db
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pre_commit/languages/lua.py
Expand Up @@ -66,7 +66,8 @@ def _get_lua_path_version(
# This could sniff out from _VERSION, but checking package.path should
# provide an answer for *exactly* where lua is looking for packages.
_, stdout, _ = cmd_output(lua_executable, '-e', 'print(package.path)')
match = re.search(fr'{os.sep}lua{os.sep}(.*?){os.sep}', stdout)
sep = os.sep if os.name != 'nt' else os.sep * 2
match = re.search(fr'{sep}lua{sep}(.*?){sep}', stdout)
if match:
return match[1]

Expand Down

0 comments on commit 3fed3db

Please sign in to comment.