Tried to fix Linux behaviour of wxPopen.py
authoretisserant
Fri, 23 May 2008 18:47:32 +0200
changeset 149 fc7fe0de9143
parent 148 8be272b35525
child 150 204d515df3dd
Tried to fix Linux behaviour of wxPopen.py
wxPopen.py
--- a/wxPopen.py	Fri May 23 16:01:49 2008 +0200
+++ b/wxPopen.py	Fri May 23 18:47:32 2008 +0200
@@ -45,21 +45,21 @@
         self.fd = fd
 
     def run(self):
-        outeof = False
-        self.retval = self.Proc.poll()
-        while not self.retval and not self.killed and not outeof:   
+        self.retval = None
+        while self.retval is None and not self.killed :
+            self.retval = self.Proc.poll()
             outchunk = self.fd.readline()
-            if outchunk == '': outeof = True
+            if outchunk == '':
+                break
             if self.callback :
                 wx.CallAfter(self.callback,outchunk)
-            self.retval=self.Proc.poll()
         if self.endcallback:
             try:
             	err = self.Proc.wait()
             except:
-            	pass
+                err = self.retval
             self.finished = True
-            wx.CallAfter(self.endcallback, self.Proc.pid, self.retval)
+            wx.CallAfter(self.endcallback, self.Proc.pid, err)
 
 class ProcessLogger:
     def __init__(self, logger, Command, finish_callback=None, no_stdout=False, no_stderr=False, no_gui=True):
@@ -90,7 +90,6 @@
         
         self.Proc = subprocess.Popen( self.Command, **popenargs )
 
-
         self.outt = outputThread(
                       self.Proc,
                       self.Proc.stdout,