Commits

windwiny committed 17be956

win32 not show cmd window

Comments (0)

Files changed (1)

 class G:
     str_encode = locale.getdefaultlocale()[1]
 
+    if sys.platform == 'win32':
+        startupinfo = subprocess.STARTUPINFO()
+        if sys.version.startswith('2.7') or sys.version.startswith('2.6'):
+            nn = subprocess._subprocess
+        else :
+            nn = subprocess
+        startupinfo.dwFlags |= nn.STARTF_USESHOWWINDOW
+        startupinfo.wShowWindow = nn.SW_HIDE
+    else:
+        startupinfo = None
+
 def create(parent):
     return grsyncdlg(parent)
 
                 self.sp.remove(sp)
 
     def create_subproc_logthread(self, cmd):
-        sp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        sp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+                              startupinfo=G.startupinfo)
         self.sp.append(sp)
 
         def thpg(sp, self):
     def OnBtnHelpButton(self, event):
         event.Skip()
         if not hasattr(self, '_rsyncdoc'):
-            sp = subprocess.Popen('rsync --help -v', stdout=subprocess.PIPE)
+            sp = subprocess.Popen('rsync --help -v', stdout=subprocess.PIPE,
+                                  startupinfo=G.startupinfo)
             self._rsyncdoc = sp.stdout.read().decode(G.str_encode)
             self._dlg = wx.Dialog(self, title=u"rsync --help", size=wx.Size(640,480),
                                   style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)