mirror of
https://github.com/ejwa/gitinspector.git
synced 2025-01-03 11:22:15 +01:00
Command-line arguments are now always converted to UTF-8 before use.
This commit is contained in:
parent
7f0e2b6fe8
commit
5c9335088a
2 changed files with 18 additions and 6 deletions
|
@ -104,10 +104,11 @@ def __check_python_version__():
|
|||
sys.exit(_("gitinspector requires at leat Python 2.6 to run (version {0} was found).").format(python_version))
|
||||
|
||||
def main():
|
||||
argv = terminal.convert_command_line_to_utf8()
|
||||
__run__ = Runner()
|
||||
|
||||
try:
|
||||
__opts__, __args__ = optval.gnu_getopt(sys.argv[1:], "cf:F:hHlLmrTwx:", ["checkout-missing:true", "exclude=",
|
||||
__opts__, __args__ = optval.gnu_getopt(argv[1:], "cf:F:hHlLmrTwx:", ["checkout-missing:true", "exclude=",
|
||||
"file-types=", "format=", "hard:true", "help",
|
||||
"list-file-types:true", "localize-output:true",
|
||||
"metrics:true", "responsibilities:true", "since=",
|
||||
|
|
|
@ -106,3 +106,14 @@ def get_size():
|
|||
def set_stdout_encoding():
|
||||
if not sys.stdout.isatty() and sys.version_info < (3,):
|
||||
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
|
||||
|
||||
def convert_command_line_to_utf8():
|
||||
try:
|
||||
argv = []
|
||||
|
||||
for arg in sys.argv:
|
||||
argv.append(arg.decode(sys.stdin.encoding, "replace"))
|
||||
|
||||
return argv;
|
||||
except AttributeError:
|
||||
return sys.argv;
|
||||
|
|
Loading…
Reference in a new issue