mirror of https://github.com/jumpserver/jumpserver
Merge pull request #9657 from jumpserver/pr@dev@fix_dbeaver_no_cli_dos
Perf: 优化DBeaver连接数据库时,不显示cli-dos窗口pull/9658/head
commit
36712f51f8
|
@ -2,8 +2,7 @@ import os
|
||||||
import time
|
import time
|
||||||
import win32api
|
import win32api
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
from pywinauto import Application
|
|
||||||
|
|
||||||
from common import wait_pid, BaseApplication
|
from common import wait_pid, BaseApplication
|
||||||
|
|
||||||
|
@ -61,16 +60,19 @@ class AppletApplication(BaseApplication):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.launch()
|
self.launch()
|
||||||
self.app = Application(backend='uia')
|
|
||||||
|
|
||||||
function = getattr(self, '_get_%s_exec_params' % self.protocol, None)
|
function = getattr(self, '_get_%s_exec_params' % self.protocol, None)
|
||||||
if function is None:
|
if function is None:
|
||||||
params = self._get_exec_params()
|
params = self._get_exec_params()
|
||||||
else:
|
else:
|
||||||
params = function()
|
params = function()
|
||||||
|
|
||||||
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
|
startupinfo.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW
|
||||||
|
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||||
exec_string = '%s -con %s' % (self.path, params)
|
exec_string = '%s -con %s' % (self.path, params)
|
||||||
self.app.start(exec_string, wait_for_idle=False)
|
ret = subprocess.Popen(exec_string, startupinfo=startupinfo)
|
||||||
self.pid = self.app.process
|
self.pid = ret.pid
|
||||||
|
|
||||||
def wait(self):
|
def wait(self):
|
||||||
wait_pid(self.pid)
|
wait_pid(self.pid)
|
||||||
|
|
Loading…
Reference in New Issue