Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions rcm/client/logic/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import shlex
from sshtunnel import SSHTunnelForwarder
import os
import sys

# local includes
from client.miscellaneous.logger import logic_logger
Expand Down Expand Up @@ -72,6 +73,12 @@ def __init__(self,
self.threadnum = SessionThread.threadscount
SessionThread.threadscount += 1

self.startupinfo = None
if sys.platform == "win32":
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
self.startupinfo = startupinfo

logic_logger.debug('Thread ' + str(self.threadnum) + ' is initialized')

def terminate(self):
Expand Down Expand Up @@ -106,7 +113,9 @@ def run(self):
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
shell=False,
universal_newlines=True)
universal_newlines=True,
startupinfo=self.startupinfo,
)
self.service_process.wait()
else:
if self.tunnelling_method == 'internal':
Expand Down Expand Up @@ -134,14 +143,15 @@ def execute_service_command_with_internal_ssh_tunnel(self):
remote_bind_address=(self.node, self.portnumber),
local_bind_address=('127.0.0.1', self.local_portnumber)
) as self.ssh_server:

self.service_process = subprocess.Popen(shlex.split(self.service_command),
bufsize=1,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
shell=False,
universal_newlines=True)
universal_newlines=True,
startupinfo=self.startupinfo,
)
self.service_process.stdin.close()
while self.service_process.poll() is None:
stdout = self.service_process.stdout.readline()
Expand All @@ -165,7 +175,9 @@ def execute_service_command_with_external_ssh_tunnel(self):
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
shell=False,
universal_newlines=True)
universal_newlines=True,
startupinfo=self.startupinfo,
)
self.service_process.stdin.close()
while self.service_process.poll() is None:
stdout = self.service_process.stdout.readline()
Expand Down