(*cmd: str)
| 59 | |
| 60 | |
| 61 | def _command_length(*cmd: str) -> int: |
| 62 | full_cmd = ' '.join(cmd) |
| 63 | |
| 64 | # win32 uses the amount of characters, more details at: |
| 65 | # https://github.com/pre-commit/pre-commit/pull/839 |
| 66 | if sys.platform == 'win32': |
| 67 | return len(full_cmd.encode('utf-16le')) // 2 |
| 68 | else: |
| 69 | return len(full_cmd.encode(sys.getfilesystemencoding())) |
| 70 | |
| 71 | |
| 72 | class ArgumentTooLongError(RuntimeError): |