57 err = self.Proc.wait() |
57 err = self.Proc.wait() |
58 self.finished = True |
58 self.finished = True |
59 wx.CallAfter(self.endcallback, self.Proc.pid, self.retval) |
59 wx.CallAfter(self.endcallback, self.Proc.pid, self.retval) |
60 |
60 |
61 class ProcessLogger: |
61 class ProcessLogger: |
62 def __init__(self, logger, Command, finish_callback=None, no_stdout=False, no_stderr=False): |
62 def __init__(self, logger, Command, finish_callback=None, no_stdout=False, no_stderr=False, no_gui=True): |
63 self.logger = logger |
63 self.logger = logger |
64 self.Command = Command |
64 self.Command = Command |
65 self.finish_callback = finish_callback |
65 self.finish_callback = finish_callback |
66 self.no_stdout = no_stdout |
66 self.no_stdout = no_stdout |
67 self.no_stderr = no_stderr |
67 self.no_stderr = no_stderr |
|
68 self.startupinfo = None |
68 self.errlen = 0 |
69 self.errlen = 0 |
69 self.outlen = 0 |
70 self.outlen = 0 |
70 self.exitcode = None |
71 self.exitcode = None |
71 self.outdata = "" |
72 self.outdata = "" |
72 self.errdata = "" |
73 self.errdata = "" |
73 self.finished = False |
74 self.finished = False |
74 |
75 |
|
76 if no_gui == True and wx.Platform == '__WXMSW__': |
|
77 self.startupinfo = subprocess.STARTUPINFO() |
|
78 self.startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW |
|
79 |
75 self.Proc = subprocess.Popen(self.Command, |
80 self.Proc = subprocess.Popen(self.Command, |
76 cwd = os.getcwd(), |
81 cwd = os.getcwd(), |
77 stdin = subprocess.PIPE, |
82 stdin = subprocess.PIPE, |
78 stdout = subprocess.PIPE, |
83 stdout = subprocess.PIPE, |
79 stderr = subprocess.STDOUT) |
84 stderr = subprocess.STDOUT, |
|
85 startupinfo = self.startupinfo) |
80 # stderr = subprocess.PIPE) |
86 # stderr = subprocess.PIPE) |
81 |
87 |
82 self.outt = outputThread( |
88 self.outt = outputThread( |
83 self.Proc, |
89 self.Proc, |
84 self.Proc.stdout, |
90 self.Proc.stdout, |