69 |
69 |
70 class ProcessLogger: |
70 class ProcessLogger: |
71 def __init__(self, logger, Command, finish_callback = None, |
71 def __init__(self, logger, Command, finish_callback = None, |
72 no_stdout = False, no_stderr = False, no_gui = True, |
72 no_stdout = False, no_stderr = False, no_gui = True, |
73 timeout = None, outlimit = None, errlimit = None, |
73 timeout = None, outlimit = None, errlimit = None, |
74 endlog = None, keyword = None, kill_it = False): |
74 endlog = None, keyword = None, kill_it = False, cwd = None): |
75 self.logger = logger |
75 self.logger = logger |
76 if not isinstance(Command, list): |
76 if not isinstance(Command, list): |
77 self.Command_str = Command |
77 self.Command_str = Command |
78 self.Command = [] |
78 self.Command = [] |
79 for i,word in enumerate(Command.replace("'",'"').split('"')): |
79 for i,word in enumerate(Command.replace("'",'"').split('"')): |
105 self.kill_it = kill_it |
105 self.kill_it = kill_it |
106 self.finishsem = Semaphore(0) |
106 self.finishsem = Semaphore(0) |
107 self.endlock = Lock() |
107 self.endlock = Lock() |
108 |
108 |
109 popenargs= { |
109 popenargs= { |
110 "cwd":os.getcwd(), |
110 "cwd":os.getcwd() if cwd is None else cwd, |
111 "stdin":subprocess.PIPE, |
111 "stdin":subprocess.PIPE, |
112 "stdout":subprocess.PIPE, |
112 "stdout":subprocess.PIPE, |
113 "stderr":subprocess.PIPE} |
113 "stderr":subprocess.PIPE} |
114 |
114 |
115 if no_gui == True and wx.Platform == '__WXMSW__': |
115 if no_gui == True and wx.Platform == '__WXMSW__': |