76 class ProcessLogger(object): |
76 class ProcessLogger(object): |
77 def __init__(self, logger, Command, finish_callback=None, |
77 def __init__(self, logger, Command, finish_callback=None, |
78 no_stdout=False, no_stderr=False, no_gui=True, |
78 no_stdout=False, no_stderr=False, no_gui=True, |
79 timeout=None, outlimit=None, errlimit=None, |
79 timeout=None, outlimit=None, errlimit=None, |
80 endlog=None, keyword=None, kill_it=False, cwd=None, |
80 endlog=None, keyword=None, kill_it=False, cwd=None, |
81 encoding=None, output_encoding=None): |
81 encoding=None, output_encoding=None, env=None): |
82 self.logger = logger |
82 self.logger = logger |
83 if not isinstance(Command, list): |
83 if not isinstance(Command, list): |
84 self.Command_str = Command |
84 self.Command_str = Command |
85 self.Command = [] |
85 self.Command = [] |
86 for i, word in enumerate(Command.replace("'", '"').split('"')): |
86 for i, word in enumerate(Command.replace("'", '"').split('"')): |
120 |
120 |
121 popenargs = { |
121 popenargs = { |
122 "cwd": os.getcwd() if cwd is None else cwd, |
122 "cwd": os.getcwd() if cwd is None else cwd, |
123 "stdin": subprocess.PIPE, |
123 "stdin": subprocess.PIPE, |
124 "stdout": subprocess.PIPE, |
124 "stdout": subprocess.PIPE, |
125 "stderr": subprocess.PIPE |
125 "stderr": subprocess.PIPE, |
|
126 "env": env |
126 } |
127 } |
127 |
128 |
128 if no_gui and os.name in ("nt", "ce"): |
129 if no_gui and os.name in ("nt", "ce"): |
129 self.startupinfo = subprocess.STARTUPINFO() |
130 self.startupinfo = subprocess.STARTUPINFO() |
130 self.startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW |
131 self.startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW |