mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Fix xargs.partition: win32 new string length computation
This commit is contained in:
parent
2560280d21
commit
c9e297ddb6
2 changed files with 5 additions and 5 deletions
|
|
@ -17,9 +17,9 @@ def _command_length(*cmd):
|
|||
full_cmd = ' '.join(cmd)
|
||||
|
||||
# win32 uses the amount of characters, more details at:
|
||||
# https://blogs.msdn.microsoft.com/oldnewthing/20031210-00/?p=41553/
|
||||
# https://github.com/pre-commit/pre-commit/pull/839
|
||||
if sys.platform == 'win32':
|
||||
return len(full_cmd)
|
||||
return len(full_cmd.encode('utf-16le')) // 2
|
||||
|
||||
return len(full_cmd.encode(sys.getfilesystemencoding()))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue