2424import shlex
2525from sshtunnel import SSHTunnelForwarder
2626import os
27+ import sys
2728
2829# local includes
2930from client .miscellaneous .logger import logic_logger
@@ -72,6 +73,12 @@ def __init__(self,
7273 self .threadnum = SessionThread .threadscount
7374 SessionThread .threadscount += 1
7475
76+ self .startupinfo = None
77+ if sys .platform == "win32" :
78+ startupinfo = subprocess .STARTUPINFO ()
79+ startupinfo .dwFlags |= subprocess .STARTF_USESHOWWINDOW
80+ self .startupinfo = startupinfo
81+
7582 logic_logger .debug ('Thread ' + str (self .threadnum ) + ' is initialized' )
7683
7784 def terminate (self ):
@@ -106,7 +113,9 @@ def run(self):
106113 stderr = subprocess .PIPE ,
107114 stdin = subprocess .PIPE ,
108115 shell = False ,
109- universal_newlines = True )
116+ universal_newlines = True ,
117+ startupinfo = self .startupinfo ,
118+ )
110119 self .service_process .wait ()
111120 else :
112121 if self .tunnelling_method == 'internal' :
@@ -134,14 +143,15 @@ def execute_service_command_with_internal_ssh_tunnel(self):
134143 remote_bind_address = (self .node , self .portnumber ),
135144 local_bind_address = ('127.0.0.1' , self .local_portnumber )
136145 ) as self .ssh_server :
137-
138146 self .service_process = subprocess .Popen (shlex .split (self .service_command ),
139147 bufsize = 1 ,
140148 stdout = subprocess .PIPE ,
141149 stderr = subprocess .PIPE ,
142150 stdin = subprocess .PIPE ,
143151 shell = False ,
144- universal_newlines = True )
152+ universal_newlines = True ,
153+ startupinfo = self .startupinfo ,
154+ )
145155 self .service_process .stdin .close ()
146156 while self .service_process .poll () is None :
147157 stdout = self .service_process .stdout .readline ()
@@ -165,7 +175,9 @@ def execute_service_command_with_external_ssh_tunnel(self):
165175 stderr = subprocess .PIPE ,
166176 stdin = subprocess .PIPE ,
167177 shell = False ,
168- universal_newlines = True )
178+ universal_newlines = True ,
179+ startupinfo = self .startupinfo ,
180+ )
169181 self .service_process .stdin .close ()
170182 while self .service_process .poll () is None :
171183 stdout = self .service_process .stdout .readline ()
0 commit comments