Skip to content

Commit 84664a6

Browse files
Use escape_decode to address windows based usage
1 parent 761aff4 commit 84664a6

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

isort/settings.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
Defines how the default settings for isort should be loaded
44
"""
5+
import codecs
56
import configparser
67
import fnmatch
78
import glob
@@ -543,12 +544,16 @@ def _check_folder_gitignore(self, folder: str) -> Optional[Path]:
543544
git_folder = Path(topfolder_result.decode("utf-8").split("\n")[0])
544545

545546
files = glob.glob(str(git_folder) + "/**/*", recursive=True)
546-
files_result = subprocess.check_output( # nosec # skipcq: PYL-W1510
547-
["git", "-C", str(git_folder), "check-ignore", "--stdin"],
548-
encoding="utf-8",
549-
env={"LANG": "C.UTF-8"},
550-
input="\n".join(files),
551-
).splitlines()
547+
files_result = (
548+
codecs.escape_decode( # type: ignore
549+
subprocess.check_output( # nosec # skipcq: PYL-W1510
550+
["git", "-C", str(git_folder), "check-ignore", "--stdin"],
551+
input="\n".join(files).encode(),
552+
)
553+
)[0]
554+
.decode("utf-8")
555+
.splitlines()
556+
)
552557

553558
self.git_ignore[git_folder] = {Path(f.strip('"')) for f in files_result}
554559

0 commit comments

Comments
 (0)