fix: tmq drop/common python script on windows
This commit is contained in:
parent
f1359076c1
commit
cc62c400c6
|
@ -578,18 +578,32 @@ class TMQCom:
|
||||||
tdLog.info("wait subscriptions exit for %d s"%wait_cnt)
|
tdLog.info("wait subscriptions exit for %d s"%wait_cnt)
|
||||||
|
|
||||||
def killProcesser(self, processerName):
|
def killProcesser(self, processerName):
|
||||||
killCmd = (
|
if platform.system().lower() == 'windows':
|
||||||
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1"
|
killCmd = ("wmic process where name=\"%s.exe\" call terminate > NUL 2>&1" % processerName)
|
||||||
% processerName
|
psCmd = ("wmic process where name=\"%s.exe\" | findstr \"%s.exe\"" % (processerName, processerName))
|
||||||
)
|
else:
|
||||||
|
killCmd = (
|
||||||
|
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1"
|
||||||
|
% processerName
|
||||||
|
)
|
||||||
|
psCmd = ("ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % processerName)
|
||||||
|
|
||||||
psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % processerName
|
processID = ""
|
||||||
processID = subprocess.check_output(psCmd, shell=True)
|
|
||||||
|
try:
|
||||||
|
processID = subprocess.check_output(psCmd, shell=True)
|
||||||
|
except Exception as err:
|
||||||
|
processID = ""
|
||||||
|
print('**** warn: ', err)
|
||||||
|
|
||||||
while processID:
|
while processID:
|
||||||
os.system(killCmd)
|
os.system(killCmd)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
processID = subprocess.check_output(psCmd, shell=True)
|
try:
|
||||||
|
processID = subprocess.check_output(psCmd, shell=True)
|
||||||
|
except Exception as err:
|
||||||
|
processID = ""
|
||||||
|
print('**** warn: ', err)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.cursor.close()
|
self.cursor.close()
|
||||||
|
|
|
@ -176,7 +176,10 @@ class TDTestCase:
|
||||||
|
|
||||||
# use taosBenchmark to subscribe
|
# use taosBenchmark to subscribe
|
||||||
binPath = self.getPath()
|
binPath = self.getPath()
|
||||||
cmd = "nohup %s -f ./7-tmq/tmqDropConsumer.json > /dev/null 2>&1 & " % binPath
|
if platform.system().lower() == 'windows':
|
||||||
|
cmd = f"mintty -h never %s -f ./7-tmq/tmqDropConsumer.json > NUL 2>&1" % binPath
|
||||||
|
else:
|
||||||
|
cmd = f"nohup %s -f ./7-tmq/tmqDropConsumer.json > /dev/null 2>&1 & " % binPath
|
||||||
tdLog.info("%s"%(cmd))
|
tdLog.info("%s"%(cmd))
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue