# HG changeset patch # User Edouard Tisserant # Date 1402393250 -7200 # Node ID c411fc7246eb831b3911f1b16c2c7d2253ced344 # Parent 8a3998d10b8115e9ceab0ac4bc7120be64786023 Allow specification of command line arguments encoding in ProcessLogger diff -r 8a3998d10b81 -r c411fc7246eb util/ProcessLogger.py --- a/util/ProcessLogger.py Wed Jun 04 13:18:23 2014 +0200 +++ b/util/ProcessLogger.py Tue Jun 10 11:40:50 2014 +0200 @@ -71,7 +71,8 @@ def __init__(self, logger, Command, finish_callback = None, no_stdout = False, no_stderr = False, no_gui = True, timeout = None, outlimit = None, errlimit = None, - endlog = None, keyword = None, kill_it = False, cwd = None): + endlog = None, keyword = None, kill_it = False, cwd = None, + encoding = None): self.logger = logger if not isinstance(Command, list): self.Command_str = Command @@ -87,8 +88,12 @@ self.Command = Command self.Command_str = subprocess.list2cmdline(self.Command) - self.Command = map(lambda x: x.encode(sys.getfilesystemencoding()), - self.Command) + fsencoding = sys.getfilesystemencoding() + + if encoding is None: + encoding = fsencoding + self.Command = [self.Command[0].encode(fsencoding)]+map( + lambda x: x.encode(encoding), self.Command[1:]) self.finish_callback = finish_callback self.no_stdout = no_stdout